Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / html / imports / import-custom-element-in-master-and-grandchild.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 <script src="../../../http/tests/htmlimports/resources/import-custom-element-helper.js"></script>
7 </head>
8 <body>
9 <script>
10 var Hello = registerTestingCustomElement('x-hello');
11 var numberOfLinks = 3;
12 var t1 = async_test('Custom elements in an indirect import and the master are both upgraded.');
13 var t2 = async_test('Custom elements in an indirect import and the master are both resolved.');
14 var latch = new ImportTestLatch(function() {
15     t1.step(function() {
16         assert_array_equals(Hello.ids.slice(0).sort(), ['hello-1', 'hello-2', 'hello-root-1', 'hello-root-2'], 'All custom elements are upgraded');
17         Hello.ids.splice(Hello.ids.indexOf('hello-2'), 1); // Remove an asynchronously loaded element.
18         assert_array_equals(Hello.ids, ['hello-root-1', 'hello-1', 'hello-root-2'], 'The upgrade order follows imports');
19         t1.done();
20     }, 0);
21
22     t2.step(function() {
23         var Bye = registerTestingCustomElement('x-bye');
24         assert_array_equals(Bye.ids.slice(0).sort(), ['bye-1', 'bye-2', 'bye-root-1', 'bye-root-2'], 'All custom elements are upgraded');
25         Bye.ids.splice(Bye.ids.indexOf('bye-2'), 1); // Remove an asynchronously loaded element.
26         assert_array_equals(Bye.ids, ['bye-root-1', 'bye-1', 'bye-root-2'], 'The upgrade order follows imports');
27         t2.done();
28     });
29 }, numberOfLinks);
30 </script>
31 <x-hello id="hello-root-1"></x-hello>
32 <x-bye id="bye-root-1"></x-bye>
33 <link rel="import" href="resources/custom-element-hello-parent-12.html" onload="latch.loaded()">
34 <x-hello id="hello-root-2"></x-hello>
35 <x-bye id="bye-root-2"></x-bye>
36 </body>
37 </html>