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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html-imports/fetching/loading-attempt.html

Issue 560893005: First checked-in import of the W3C's test suites. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add new expectations for newly failing w3c tests Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Fetching import</title>
5 <link rel="help" href="http://w3c.github.io/webcomponents/spec/imports/#fetching -import">
6 <script src="../../../../resources/testharness.js"></script>
7 <script src="../../../../resources/testharnessreport.js"></script>
8 <link rel="stylesheet" href="../../../../resources/testharness.css">
9
10 <script>
11 var onloadWasCalledOnSuccess = false;
12 var onerrorWasCalledOnSuccess = false;
13 function helloLoadHandler() { onloadWasCalledOnSuccess = true; }
14 function helloErrorHandler() { onerrorWasCalledOnSuccess = true; }
15
16 var onloadWasCalledOnFail = false;
17 var onerrorWasCalledOnFail = false;
18 function nosuchLoadHandler() { onloadWasCalledOnFail = true; }
19 function nosuchErrorHandler() { onerrorWasCalledOnFail = true; }
20 </script>
21
22 <link rel="import" href="resources/hello.html" onload="helloLoadHandler()" onerr or="helloLoadHandler()">
23 <link rel="import" href="resources/no-such.html" onload="nosuchLoadHandler()" on error="nosuchErrorHandler()">
24
25 <script>
26 test(function() {
27 assert_true(onloadWasCalledOnSuccess);
28 assert_false(onerrorWasCalledOnSuccess);
29 }, 'The loading attempt must be considered successful if IMPORT is not null on t he algorithm completion, and failed otherwise. (1)');
30
31 test(function() {
32 assert_false(onloadWasCalledOnFail);
33 assert_true(onerrorWasCalledOnFail);
34 }, 'The loading attempt must be considered successful if IMPORT is not null on t he algorithm completion, and failed otherwise. (2)');
35
36 t1 = async_test('The loading attempt must be considered successful if IMPORT is not null on the algorithm completion, and failed otherwise. (3)')
37 t1.step(function() {
38 var importElement = document.createElement('link');
39 importElement.setAttribute('rel', 'import');
40 importElement.setAttribute('href', 'resources/dynamic.html');
41 importElement.addEventListener("error", assert_unreached);
42 importElement.addEventListener("load", function() {
43 t1.done();
44 });
45
46 document.head.appendChild(importElement);
47 });
48
49 var onloadWasCalledOnAsync = false;
50 var onerrorWasCalledOnAsync = false;
51 var asyncAttemptDone = function() { assert_unreached(); };
52
53 function asyncLoadHandler() {
54 onloadWasCalledOnAsync = true;
55 asyncAttemptDone();
56 }
57 function asyncErrorHandler() {
58 onerrorWasCalledOnAsync = true;
59 asyncAttemptDone();
60 }
61
62 t2 = async_test('Every import that is not marked as async delays the load event in the Document.');
63 asyncAttemptDone = function() {
64 t2.step(function() {
65 assert_true(onloadWasCalledOnAsync);
66 assert_false(onerrorWasCalledOnAsync);
67 t2.done();
68 });
69 };
70
71 </script>
72 <link rel="import" href="resources/async.html" onload="asyncLoadHandler()" onerr or="asyncErrorHandler()" async>
73 </head>
74 <body>
75 <div id="log"></div>
76 </body>
77 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698