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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/resources/testharnessreport.js

Issue 1994683004: Add web platform pointerevents tests to Layouttest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * THIS FILE INTENTIONALLY LEFT BLANK 2 * THIS FILE INTENTIONALLY LEFT BLANK
3 * 3 *
4 * More specifically, this file is intended for vendors to implement 4 * More specifically, this file is intended for vendors to implement
5 * code needed to integrate testharness.js tests with their own test systems. 5 * code needed to integrate testharness.js tests with their own test systems.
6 * 6 *
7 * Typically such integration will attach callbacks when each test is 7 * Typically such integration will attach callbacks when each test is
8 * has run, using add_result_callback(callback(test)), or when the whole test fi le has 8 * has run, using add_result_callback(callback(test)), or when the whole test fi le has
9 * completed, using add_completion_callback(callback(tests, harness_status)). 9 * completed, using add_completion_callback(callback(tests, harness_status)).
10 * 10 *
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 function isCSSWGTest() { 59 function isCSSWGTest() {
60 var flags = document.querySelector('meta[name=flags]'), 60 var flags = document.querySelector('meta[name=flags]'),
61 content = flags ? flags.getAttribute('content') : null; 61 content = flags ? flags.getAttribute('content') : null;
62 return content && content.match(/\bdom\b/); 62 return content && content.match(/\bdom\b/);
63 } 63 }
64 64
65 function isJSTest() { 65 function isJSTest() {
66 return !!document.querySelector('script[src*="/resources/testharness"]') ; 66 return !!document.querySelector('script[src*="/resources/testharness"]') ;
67 } 67 }
68 68
69 function injectSyntheticInput() {
70 var path = window.location.pathname;
71 if (path.match(/imported\/wpt\/.*\.html$/)) {
72 path = path.replace(/imported\/wpt\/(.*)\.html$/, "imported/wpt_auto mation/$1-input.js");
73 var input_script = document.createElement('script');
74 input_script.setAttribute('src', path);
75 document.head.appendChild(input_script);
76 }
77 }
78
69 var didDispatchLoadEvent = false; 79 var didDispatchLoadEvent = false;
70 var handleLoad = function() { 80 var handleLoad = function() {
71 didDispatchLoadEvent = true; 81 didDispatchLoadEvent = true;
72 window.removeEventListener('load', handleLoad); 82 window.removeEventListener('load', handleLoad);
83 // Add synthetic input to pointer event manual tests
84 if(window.location.pathname.includes('imported/wpt/pointerevents/')) {
85 setTimeout(injectSyntheticInput, 0);
86 }
73 }; 87 };
74 window.addEventListener('load', handleLoad, false); 88 window.addEventListener('load', handleLoad, false);
75 89
76 // Using a callback function, test results will be added to the page in a 90 // Using a callback function, test results will be added to the page in a
77 // manner that allows dumpAsText to produce readable test results. 91 // manner that allows dumpAsText to produce readable test results.
78 add_completion_callback(function (tests, harness_status) { 92 add_completion_callback(function (tests, harness_status) {
79 93
80 // Create element to hold results. 94 // Create element to hold results.
81 var results = document.createElement("pre"); 95 var results = document.createElement("pre");
82 96
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // another completion callback might generate more results. So, we 146 // another completion callback might generate more results. So, we
133 // don't dump the results immediately. 147 // don't dump the results immediately.
134 setTimeout(done, 0); 148 setTimeout(done, 0);
135 } else { 149 } else {
136 // Parsing the test HTML isn't finished yet. 150 // Parsing the test HTML isn't finished yet.
137 window.addEventListener('load', done); 151 window.addEventListener('load', done);
138 } 152 }
139 }); 153 });
140 154
141 })(); 155 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698