Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: LayoutTests/fast/html/imports/import-custom-element-async-resolve.html

Issue 249563003: REGRESSION(r171966): Custom elements in async imports don't get upgrade. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/html/imports/import-custom-element-async-resolve-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fb17f6011709bf06cf106de2ee59e1caa7e8385d
--- /dev/null
+++ b/LayoutTests/fast/html/imports/import-custom-element-async-resolve.html
@@ -0,0 +1,65 @@
+<!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 + 4; // + 4 for grandchildren
+var expectedHelloList = ['hello-1', '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'];
+var expectedByeList = ['bye-1', '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'];
+
+var latch = new ImportTestLatch(function() {
+
+ t1.step(function() {
+ assert_equals('hello-1', Hello.ids[0]);
+ assert_array_equals(expectedHelloList, Hello.ids.slice(0).sort());
+
+ assert_true(Hello.ids.indexOf('hello-p34-1') < Hello.ids.indexOf('hello-3'), 'Order check heello-3');
+ assert_true(Hello.ids.indexOf('hello-3') < Hello.ids.indexOf('hello-p34-2'), 'Order check hello-p34-2');
+ assert_true(Hello.ids.indexOf('hello-3') < Hello.ids.indexOf('hello-7'), 'Order check 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'), 'Order check hello-5');
+ assert_true(Hello.ids.indexOf('hello-5') < Hello.ids.indexOf('hello-p56-2'), 'Order check hellop56-2');
+
+ t1.done();
+ });
+
+ t2.step(function() {
+ var Bye = registerTestingCustomElement('x-bye');
+
+ assert_equals('bye-1', Bye.ids[0]);
+ assert_array_equals(expectedByeList, Bye.ids.slice(0).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>
« no previous file with comments | « no previous file | LayoutTests/fast/html/imports/import-custom-element-async-resolve-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698