Chromium Code Reviews| 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..25c173c4e2b6f6d1d4a4149909c1c53d9f5eb604 |
| --- /dev/null |
| +++ b/LayoutTests/fast/html/imports/import-custom-element-async-resolve.html |
| @@ -0,0 +1,62 @@ |
| +<!DOCTYPE html> |
|
dominicc (has gone to gerrit)
2014/04/25 02:39:45
I think you need a test for imports like
A import
|
| +<html> |
| +<head> |
| +<script src="../../../resources/testharness.js"></script> |
| +<script src="../../../resources/testharnessreport.js"></script> |
| +<script src="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.'); |
|
dominicc (has gone to gerrit)
2014/04/25 02:39:45
I had no idea the test harness could interleave te
|
| +var t2 = async_test('Resolve custom elements in async imports later.'); |
| +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(); |
| + }); |
| +}, 6); |
|
dominicc (has gone to gerrit)
2014/04/25 02:39:45
Might be nice to use an explaining variable for th
|
| +</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> |