OLD | NEW |
| 1 <!-- |
| 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
| 3 * source code is governed by a BSD-style license that can be found in the |
| 4 * LICENSE file. |
| 5 --> |
1 <html> | 6 <html> |
2 <!-- | 7 <!-- |
3 This test file causes Chrome to attempt to create the NaCl plugin as a simple | 8 This test file causes Chrome to attempt to create the NaCl plugin as a simple |
4 embed and as a content type handler. The script allows the test to check if | 9 embed and as a content type handler. The script allows the test to check if |
5 the plugin was created or blocked in either case. | 10 the plugin was created or blocked in either case. |
6 --> | 11 --> |
7 <head> | 12 <head> |
8 <title>Native Client CWS Restriction</title> | 13 <title>Native Client CWS Restriction</title> |
9 | 14 |
10 <script> | 15 <script src="test.js"></script> |
11 var embedded_event; | |
12 var content_handler_event; | |
13 | |
14 function setListeners(body_element) { | |
15 var eventListener = function(e) { | |
16 var target_element = e.target; | |
17 if (target_element.className != 'naclModule') | |
18 return; | |
19 | |
20 var element_id = target_element.id; | |
21 if (element_id == 'embedded') | |
22 embedded_event = e.type; | |
23 else if (element_id == 'content_handler') | |
24 content_handler_event = e.type; | |
25 } | |
26 body_element.addEventListener('loadstart', eventListener, true); | |
27 body_element.addEventListener('error', eventListener, true); | |
28 } | |
29 | |
30 function EmbeddedPluginCreated() { | |
31 return embedded_event != undefined; | |
32 } | |
33 | |
34 function ContentHandlerPluginCreated() { | |
35 return content_handler_event != undefined; | |
36 } | |
37 | |
38 </script> | |
39 | 16 |
40 </head> | 17 </head> |
41 <body> | 18 <body> |
42 <script> | 19 <script src="test2.js"></script> |
43 setListeners(document.body); | |
44 </script> | |
45 <embed id="embedded" | 20 <embed id="embedded" |
46 class="naclModule" | 21 class="naclModule" |
47 type="application/x-nacl" | 22 type="application/x-nacl" |
48 src="dummy.nmf"> | 23 src="dummy.nmf"> |
49 </embed> | 24 </embed> |
50 <embed id="content_handler" | 25 <embed id="content_handler" |
51 class="naclModule" | 26 class="naclModule" |
52 type="application/pdf" | 27 type="application/pdf" |
53 src="test.pdf"> | 28 src="test.pdf"> |
54 </embed> | 29 </embed> |
55 </body> | 30 </body> |
56 </html> | 31 </html> |
OLD | NEW |