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

Unified Diff: chrome/test/data/prerender/prefetch_page.html

Issue 2438593002: [NoStatePrefetch] Remove JS injection in tests (Closed)
Patch Set: PrefetchSimple: check the should-be-fetched resource is indeed fetched Created 4 years, 2 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 | « chrome/test/data/prerender/prefetch.js ('k') | chrome/test/data/prerender/prefetch_page2.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/prerender/prefetch_page.html
diff --git a/chrome/test/data/prerender/prefetch_page.html b/chrome/test/data/prerender/prefetch_page.html
index 9009fb41801f6397af23d22454c7f1e091995b37..311f9f1ffb2e89772e0195e0ace8ee9b822c4101 100644
--- a/chrome/test/data/prerender/prefetch_page.html
+++ b/chrome/test/data/prerender/prefetch_page.html
@@ -1,20 +1,25 @@
<html>
<!--
-Prefetch page which fetches a script. It includes some javascript that can be
-used to test whether execution occurred.
--->
-<head>
-<title>Prefetch Page</title>
-<script src="prefetch.js" type="text/javascript"></script>
+A page that fetches only "prefetch.js" when scanned by NoStatePrefetch, and
+fetches "prefetch2.js" in addition to that if javascript execution is preformed
+on the page. In all cases the scripts are executed in a blocking manner.
-<script>
-// Variables to test if javascript is executed.
-var pageBool = true;
-var pageAntiBool = false;
-</script>
+By prefetching this page a browsertest can verify that javascript was not
+executed (prefetch2.js should not be requested to load even after the page has
+been fully prefetched (or loaded)).
-</head>
+Note: there is no way to ensure that the script loaded via .appendChild() or a
+sync XHR happens before a preload-scannable request because preload scanner is
+racy and often fetches resources it sees before the inline script has a chance
+to execute.
+-->
<body>
-Page content that is necessary for first contentful paint metrics
+ <script src="prefetch.js"></script>
+ <script>
+ var s = document.createElement("script");
+ s.src = "prefetch2.js";
+ document.body.appendChild(s);
+ </script>
+ Some content that is necessary for registering paint metrics.
</body>
</html>
« no previous file with comments | « chrome/test/data/prerender/prefetch.js ('k') | chrome/test/data/prerender/prefetch_page2.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698