Index: third_party/WebKit/LayoutTests/http/tests/preload/document_write_preload_stubs.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/preload/document_write_preload.html b/third_party/WebKit/LayoutTests/http/tests/preload/document_write_preload_stubs.html |
similarity index 50% |
copy from third_party/WebKit/LayoutTests/http/tests/preload/document_write_preload.html |
copy to third_party/WebKit/LayoutTests/http/tests/preload/document_write_preload_stubs.html |
index 4cca6884b7a94b7785c910348726cf4143a2b874..3d5e8f84d3ce49781f9417eb6abf1b0934eb4b21 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/preload/document_write_preload.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/preload/document_write_preload_stubs.html |
@@ -2,21 +2,24 @@ |
<script src="../resources/testharness.js"></script> |
<script src="../resources/testharnessreport.js"></script> |
<script> |
-var t = async_test('Simple scripts that inject external scripts via document.write should be preloaded'); |
+var t = async_test('Accessors like location should be properly stubbed to aid in preloading scripts injected via document.write'); |
// We reject scripts with "for" |
window.perf = window.performance; |
</script> |
<script> |
if (window.perf) |
var boundedStart = window.perf.now(); |
-var src = '../resources/dummy.js'; |
+var src = window.location.protocol + '//' + window.location.hostname + ':8000' + '/resources/dummy.js'; |
Bryan McQuade
2016/04/05 20:34:09
IIUC cross origin resources report timing values o
Charlie Harrison
2016/04/05 21:56:30
Does this count as cross origin? I'm seeing valid
|
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>'); |
</script> |
<script> |
window.addEventListener("load", t.step_func(function() { |
- var resourceTiming = window.performance.getEntriesByType('resource')[2]; |
- assert_less_than(resourceTiming.startTime, boundedStart); |
- t.done(); |
+ window.performance.getEntriesByType('resource').forEach(function(r) { |
+ if (r.name.indexOf('dummy.js') != -1) { |
+ assert_less_than(r.startTime, boundedStart); |
Bryan McQuade
2016/04/05 20:34:09
given the above, we should probably assert that r.
Charlie Harrison
2016/04/05 21:56:30
Done.
|
+ t.done(); |
+ } |
+ }); |
})); |
</script> |