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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/navigation-timing/test_navigation_type_reload.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.navigation.type with a reloaded navigation</ti tle>
6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
7 <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navig ation-timing-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('navigation');
16 var reload_frame;
17 var startingTime;
18
19 function deepCopy(p, c)
20 {
21 var c = c || {};
22 for (var i in p)
23 {
24 if (typeof p[i] === 'object')
25 {
26 c[i] = (p[i].constructor === Array) ? [] : {};
27 deepCopy(p[i], c[i]);
28 } else c[i] = p[i];
29 }
30 return c;
31 }
32
33
34 function onload_test()
35 {
36 reload_frame = document.getElementById("frameContext");
37 reload_frame.onload = function() {
38 /* Need to make sure we don't examine loadEventEnd
39 until after the load event has finished firing */
40 setTimeout(do_test, 0);
41 }
42 setTimeout("reload_the_frame();", 100);
43 }
44
45 function reload_the_frame()
46 {
47 //Before reloading, save the current timing
48 startingTime = deepCopy(reload_frame.contentWindow.performance.t iming);
49 reload_frame.contentWindow.location.reload(true);
50 }
51
52 function do_test()
53 {
54 reload_frame.onload = null;
55 if (performanceNamespace)
56 {
57 //Verify that the navigation type has updated to reload
58 test_equals(reload_frame.contentWindow.performance.navigatio n.type,
59 performanceNamespace.navigation.TYPE_RELOAD,
60 'window.performance.navigation.type == TYPE_RELOAD') ;
61
62 //Verify that the timing data has been updated into the futu re
63 var reloadTime = reload_frame.contentWindow.performance.timi ng;
64 for (attribute in timingAttributes)
65 {
66 var time = timingAttributes[attribute];
67 if (reloadTime[time] === 0)
68 {
69 test_equals(reloadTime[time],
70 startingTime[time],
71 "Reload " + time + "(" + reloadTime[time ] + ")" +
72 " == " +
73 "Original " + time + "(" + startingTime[ time] + ")");
74 }
75 else
76 {
77 test_greater_than(reloadTime[time],
78 startingTime[time],
79 "Reload " + time +
80 " > " +
81 "Original " + time);
82 }
83 }
84 }
85
86 done();
87 }
88 </script>
89 </head>
90 <body onload="onload_test();">
91 <h1>Description</h1>
92 <p>This test validates the value of window.performance.navigation.type a nd the values of
93 window.performance.timing.* with a reloaded navigation.</p>
94
95 <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
96 and then verified that
97 <ul>
98 <li>The window.performance.navigation.type = TYPE_RELOAD</li>
99 <li>All of the widow.performance.timing.* values after reload are > all of the window.performance.timing.* values
100 prior to reload.</li>
101 </ul>
102 </p>
103
104 <div id="log"></div>
105 <br />
106 <iframe id="frameContext" src="resources/blank_page_green.html" style="w idth: 250px; height: 250px;"></iframe>
107 </body>
108 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698