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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/navigation-timing/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>window.performance.timing for dynamically created documents</title>
6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
7 <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-ti ming-interface"/>
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 <script src="resources/webperftestharness.js"></script>
11 <script>
12 setup({explicit_done: true});
13
14 // explicitly test the namespace before we start testing
15 test_namespace();
16
17 var originalTiming = {};
18 var didOpen = false;
19
20 function onload_test() {
21 if (!didOpen) {
22 setTimeout(testTimingWithDocumentOpen, 0);
23 didOpen = true;
24 }
25 }
26
27 function testTimingWithDocumentOpen() {
28 var subcontentWindow = document.getElementById("frameContext").contentWindow;
29
30 if (subcontentWindow.performance === undefined)
31 {
32 // avoid script errors
33 done();
34 return;
35 }
36
37 var timing = subcontentWindow.performance.timing;
38 for (i in timingAttributes) {
39 originalTiming[timingAttributes[i]] = timing[timingAttributes[i]];
40 }
41
42 var subdocument = subcontentWindow.document;
43 subdocument.open();
44 subdocument.write('<!DOCTYPE HTML>');
45 subdocument.write('<html>');
46 subdocument.write('<head>');
47 subdocument.write('<meta charset="utf-8" />');
48 subdocument.write('<title><Green Test Page</title>');
49 subdocument.write('</head>');
50 subdocument.write('<body style="background-color:#00FF00;">');
51 subdocument.write('</body>');
52 subdocument.write('</html>');
53 subdocument.close();
54
55 setTimeout(function() {
56 var timing = subcontentWindow.performance.timing;
57 for (var i in timingAttributes) {
58 test_equals(timing[timingAttributes[i]],
59 originalTiming[timingAttributes[i]],
60 timingAttributes[i] + " is the same after document open.");
61 }
62 done();
63 }, 0);
64 }
65 </script>
66 </head>
67 <body>
68 <h1>Description</h1>
69 <p>This test validates window.performance.timing remains constant when a
70 document is replaced using document.open.</p>
71
72 <p>This page should be loaded with a yellow frame below. It then replaces the
73 document in that frame with a green document.</p>
74
75 <p>The test passes if all of the checks to performance.timing are correct and
76 the frame below ends with a green background.</p>
77
78 <div id="log"></div>
79 <br />
80 <iframe id="frameContext" onload="onload_test();" src="resources/blank_page_yell ow.html" style="width: 250px; height: 250px;"></iframe>
81 </body>
82 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698