1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.html;
16
17 import java.util.ArrayList;
18 import java.util.List;
19
20 import org.htmlunit.CollectingAlertHandler;
21 import org.htmlunit.MockWebConnection;
22 import org.htmlunit.SimpleWebTestCase;
23 import org.htmlunit.WebClient;
24 import org.htmlunit.junit.BrowserRunner;
25 import org.htmlunit.junit.annotation.Alerts;
26 import org.junit.Test;
27 import org.junit.runner.RunWith;
28
29
30
31
32
33
34
35 @RunWith(BrowserRunner.class)
36 public class HtmlObjectTest extends SimpleWebTestCase {
37
38
39
40 @Test
41 @Alerts("undefined")
42 public void classid() throws Exception {
43 final String html = DOCTYPE_HTML
44 + "<html><head>\n"
45
46 + "<object id='wm' classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'></object>\n"
47 + "<script>\n"
48 + " function test() {\n"
49 + " alert(document.all.wm.fullScreen);\n"
50 + " }\n"
51 + "</script>\n"
52 + "</head><body onload='test()'>\n"
53 + "</body></html>";
54
55 final WebClient client = getWebClient();
56 final List<String> collectedAlerts = new ArrayList<>();
57 client.setAlertHandler(new CollectingAlertHandler(collectedAlerts));
58
59 final MockWebConnection webConnection = new MockWebConnection();
60 webConnection.setResponse(URL_FIRST, html);
61 client.setWebConnection(webConnection);
62
63 client.getPage(URL_FIRST);
64 assertEquals(getExpectedAlerts(), collectedAlerts);
65 }
66 }