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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/navigation-timing/nav2_test_unique_nav_instances.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-Per formanceNavigationTiming"/>
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 </head>
11 <body>
12 <h1>Description</h1>
13 <p>This test validates that each window has a unique nav timing 2 instan ce.</p>
14 <iframe id="frameContext" src="resources/blank_page_green.html" style="d isplay:none;";></iframe>
15 <script>
16
17 var navTiming2Attributes = [
18 'connectEnd',
19 'connectStart',
20 'decodedBodySize',
21 'domComplete',
22 'domContentLoadedEventEnd',
23 'domContentLoadedEventStart',
24 'domInteractive',
25 'domainLookupEnd',
26 'domainLookupStart',
27 'duration',
28 'encodedBodySize',
29 'entryType',
30 'fetchStart',
31 'initiatorType',
32 'loadEventEnd',
33 'loadEventStart',
34 'name',
35 'redirectCount',
36 'redirectEnd',
37 'redirectStart',
38 'requestStart',
39 'responseEnd',
40 'responseStart',
41 'secureConnectionStart',
42 'transferSize',
43 'type',
44 'unloadEventEnd',
45 'unloadEventStart',
46 'workerStart'
47 ];
48
49 function not_same_instance(instance1, instance2, attributes) {
50 for (var i in attributes) {
51 if (instance1[attributes[i]] != instance2[attributes[i]])
52 return true;
53 }
54 return false;
55 }
56
57 async_test(function (t) {
58 var observer = new PerformanceObserver(
59 t.step_func(function (entryList) {
60 assert_equals(entryList.getEntriesByType("navigation").l ength, 1, "Only one nav timing instance exists.");
61 assert_equals(document.getElementById("frameContext").co ntentWindow.performance.getEntriesByType("navigation").length, 1,
62 "Only one nav timing instance exists.");
63 var main_frame_instance = entryList.getEntriesByType("na vigation")[0];
64 var iframe_instance = document.getElementById("frameCont ext").contentWindow.performance.getEntriesByType("navigation")[0];
65 assert_true(not_same_instance(main_frame_instance, ifram e_instance, navTiming2Attributes),
66 "Two nav timing instances are not the same instance. ");
67 observer.disconnect();
68 t.done();
69 })
70 );
71 observer.observe({entryTypes: ["navigation"]});
72
73 }, "Each window has a unique nav timing 2 instance.");
74 </script>
75 </body>
76 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698