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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/navigation-timing/nav2_test_document_open.html

Issue 2676573004: Import wpt@6010f54a979d242f657b284bae53c2b218c533f4 (Closed)
Patch Set: Update test expectations and baselines. Created 3 years, 10 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8" />
5 <title>Navigation Timing 2 WPT</title>
6 <link rel="author" title="Google" href="http://www.google.com/" />
7 <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-P erformanceNavigationTiming"/>
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 <script>
11 var navTiming2Attributes = [
12 'connectEnd',
13 'connectStart',
14 'decodedBodySize',
15 'domComplete',
16 'domContentLoadedEventEnd',
17 'domContentLoadedEventStart',
18 'domInteractive',
19 'domainLookupEnd',
20 'domainLookupStart',
21 'duration',
22 'encodedBodySize',
23 'entryType',
24 'fetchStart',
25 'initiatorType',
26 'loadEventEnd',
27 'loadEventStart',
28 'name',
29 'redirectCount',
30 'redirectEnd',
31 'redirectStart',
32 'requestStart',
33 'responseEnd',
34 'responseStart',
35 'secureConnectionStart',
36 'transferSize',
37 'type',
38 'unloadEventEnd',
39 'unloadEventStart',
40 'workerStart'
41 ];
42
43 var originalTiming = {};
44 var didOpen = false;
45
46 function onload_test()
47 {
48 if (!didOpen) {
49 setTimeout(testTimingWithDocumentOpen, 0);
50 didOpen = true;
51 }
52 }
53
54 function testTimingWithDocumentOpen()
55 {
56 var subcontentWindow = document.getElementById("frameContext") .contentWindow;
57
58 var timing = subcontentWindow.performance.getEntriesByType("na vigation")[0];
59 for (i in navTiming2Attributes) {
60 originalTiming[navTiming2Attributes[i]] = timing[navTiming 2Attributes[i]];
61 }
62
63 var subdocument = subcontentWindow.document;
64 subdocument.open();
65 subdocument.write('<!DOCTYPE HTML>');
66 subdocument.write('<html>');
67 subdocument.write('<head>');
68 subdocument.write('<meta charset="utf-8" />');
69 subdocument.write('<title><Green Test Page</title>');
70 subdocument.write('</head>');
71 subdocument.write('<body style="background-color:#00FF00;">');
72 subdocument.write('</body>');
73 subdocument.write('</html>');
74 subdocument.close();
75
76 setTimeout(function() {
77 var timing = subcontentWindow.performance.getEntriesByType ("navigation")[0];
78 for (var i in navTiming2Attributes) {
79 assert_equals(originalTiming[navTiming2Attributes[i]], timing[navTiming2Attributes[i]],
80 navTiming2Attributes[i] + " is the same after docume nt open.");
81 }
82 done();
83 }, 0);
84 }
85 </script>
86 </head>
87 <body>
88 <h1>Description</h1>
89 <p>This test validates window.performance.getEntriesByType("navigation ") remains constant when a
90 document is replaced using document.open.</p>
91
92 <p>This page should be loaded with a yellow frame below. It then repla ces the
93 document in that frame with a green document.</p>
94
95 <p>The test passes if all of the checks to performance.getEntriesByTyp e("navigation") are correct and
96 the frame below ends with a green background.</p>
97
98 <iframe id="frameContext" onload="onload_test();" src="resources/blank _page_yellow.html" style="width: 250px; height: 250px;"></iframe>
99 </body>
100 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698