- add sources.
[platform/framework/web/crosswalk.git] / src / chrome_frame / test / data / CFInstall_place.html
1 <html>
2   <head>
3     <script type="text/javascript"
4             src="chrome_frame_tester_helpers.js"></script>
5     <script type="text/javascript"
6             src="CFInstall.js"></script>
7   </head>
8   <body>
9     <div id="statusPanel" style="border: 1px solid red; width: 100%">
10       Test running....
11     </div>
12
13     <div id="parent">
14       <div id="prev">before</div><div id="toBeReplaced">
15         fallback content goes here
16       </div><div id="after">after</div>
17     </div>
18     <script type="text/javascript">
19       var testName = 'CFInstallPlace';
20       (function(){
21         try{
22           // Testing over-rides for GCF detection code.
23           CFInstall._force = true;
24           CFInstall._forceValue = false;
25
26           CFInstall.check({
27             node: 'toBeReplaced',
28             id: 'prompt',
29             cssText: 'width: 400px; height: 300px;',
30             mode: 'inline'
31           });
32
33           var p = byId('prompt');
34
35           if (!p) {
36             onFailure(testName, 1, 'prompt not created with correct ID');
37             return;
38           }
39
40           var fc = document.body.firstChild;
41
42           if (fc.nodeType == 1 && fc.tagName == 'IFRAME') {
43             onFailure(testName, 1, 'prompt placed incorrectly');
44             return;
45           }
46
47           if (p.tagName != 'IFRAME') {
48             onFailure(testName, 1, 'prompt has wrong tag type');
49             return;
50           }
51
52           // Ensure that it got dropped into the right bit of the DOM
53           if (byId('prev').nextSibling != p) {
54             onFailure(testName, 1, 'prompt placed incorrectly');
55             return;
56           }
57
58           // Make sure that the geometry took.
59           if (p.style.width != '400px') {
60             onFailure(testName, 1, 'prompt sized incorrectly');
61             return;
62           }
63
64           onSuccess(testName, 1);
65
66         } catch (e) {
67           onFailure(testName, 1,
68                     'CFInstall placement failed with error: '+e);
69         }
70       })();
71     </script>
72     <p>Tests CFInstall prompt placement</p>
73   </body>
74 </html>