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.annotation.Alerts;
25 import org.junit.jupiter.api.Test;
26
27
28
29
30
31
32
33 public class HtmlObjectTest extends SimpleWebTestCase {
34
35
36
37 @Test
38 @Alerts("undefined")
39 public void classid() throws Exception {
40 final String html = DOCTYPE_HTML
41 + "<html><head>\n"
42
43 + "<object id='wm' classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'></object>\n"
44 + "<script>\n"
45 + " function test() {\n"
46 + " alert(document.all.wm.fullScreen);\n"
47 + " }\n"
48 + "</script>\n"
49 + "</head><body onload='test()'>\n"
50 + "</body></html>";
51
52 final WebClient client = getWebClient();
53 final List<String> collectedAlerts = new ArrayList<>();
54 client.setAlertHandler(new CollectingAlertHandler(collectedAlerts));
55
56 final MockWebConnection webConnection = new MockWebConnection();
57 webConnection.setResponse(URL_FIRST, html);
58 client.setWebConnection(webConnection);
59
60 client.getPage(URL_FIRST);
61 assertEquals(getExpectedAlerts(), collectedAlerts);
62 }
63 }