| Index: LayoutTests/fast/html/imports/import-custom-element-async-resolve.html
|
| diff --git a/LayoutTests/fast/html/imports/import-custom-element-async-resolve.html b/LayoutTests/fast/html/imports/import-custom-element-async-resolve.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..485a3524fbb3e9c9e01f009e69aa47853c0a7789
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/html/imports/import-custom-element-async-resolve.html
|
| @@ -0,0 +1,63 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<script src="../../../http/tests/htmlimports/resources/import-custom-element-helper.js"></script>
|
| +</head>
|
| +<body>
|
| +<script>
|
| +var Hello = registerTestingCustomElement('x-hello');
|
| +
|
| +var t1 = async_test('Instantiate custom elements in async imports.');
|
| +var t2 = async_test('Resolve custom elements in async imports later.');
|
| +var numberOfLinks = 6;
|
| +var latch = new ImportTestLatch(function() {
|
| + t1.step(function() {
|
| + assert_equals('hello-1', Hello.ids[0]);
|
| + assert_array_equals(['hello-2', 'hello-3', 'hello-4', 'hello-5', 'hello-6', 'hello-7', 'hello-8', 'hello-p34-1', 'hello-p34-2', 'hello-p56-1', 'hello-p56-2'],
|
| + Hello.ids.slice(1).sort());
|
| +
|
| + assert_true(Hello.ids.indexOf('hello-p34-1') < Hello.ids.indexOf('hello-3'));
|
| + assert_true(Hello.ids.indexOf('hello-3') < Hello.ids.indexOf('hello-p34-2'));
|
| + assert_true(Hello.ids.indexOf('hello-3') < Hello.ids.indexOf('hello-7'));
|
| +
|
| + // Even though parent-2 is loaded in async, its content should follow the order.
|
| + assert_true(Hello.ids.indexOf('hello-p56-1') < Hello.ids.indexOf('hello-5'));
|
| + assert_true(Hello.ids.indexOf('hello-5') < Hello.ids.indexOf('hello-p56-2'));
|
| +
|
| + t1.done();
|
| + });
|
| +
|
| + t2.step(function() {
|
| + var Bye = registerTestingCustomElement('x-bye');
|
| +
|
| + assert_equals('bye-1', Bye.ids[0]);
|
| + assert_array_equals(['bye-2', 'bye-3', 'bye-4', 'bye-5', 'bye-6', 'bye-7', 'bye-8', 'bye-p34-1', 'bye-p34-2', 'bye-p56-1', 'bye-p56-2'],
|
| + Bye.ids.slice(1).sort());
|
| + assert_true(Bye.ids.indexOf('bye-p34-1') < Bye.ids.indexOf('bye-3'));
|
| + assert_true(Bye.ids.indexOf('bye-3') < Bye.ids.indexOf('bye-p34-2'));
|
| + assert_true(Bye.ids.indexOf('bye-3') < Bye.ids.indexOf('bye-7'));
|
| + assert_true(Bye.ids.indexOf('bye-p56-1') < Bye.ids.indexOf('bye-5'));
|
| + assert_true(Bye.ids.indexOf('bye-5') < Bye.ids.indexOf('bye-p56-2'));
|
| +
|
| + t2.done();
|
| + });
|
| +}, numberOfLinks);
|
| +</script>
|
| +<link rel="import" href="resources/custom-element-hello-1.html" onload="latch.loaded()">
|
| +<link rel="import" href="resources/custom-element-hello-2.html" async onload="latch.loaded()">
|
| +<link rel="import" href="resources/custom-element-hello-parent-34.html" onload="latch.loaded()">
|
| +<link rel="import" href="resources/custom-element-hello-parent-56.html" async onload="latch.loaded()">
|
| +<link rel="import" href="resources/custom-element-hello-7.html" onload="latch.loaded()">
|
| +<script>
|
| +(function() {
|
| + var link = document.createElement('link');
|
| + link.href = 'resources/custom-element-hello-8.html';
|
| + link.rel = 'import';
|
| + link.onload = latch.loaded.bind(latch);
|
| + document.head.appendChild(link);
|
| +})();
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|