Bug 1445109 [wpt PR 9986] - ResourceTiming Issue 138: initiatorType test cases, a=testonly
authorYoav Weiss <yoav@yoav.ws>
Mon, 09 Apr 2018 17:07:53 +0000
changeset 467087 a9434efe00ee91def95f9e4acd96eb79d6279a72
parent 467086 22af92a91fe78c49fa45bda6fc9b06b33833cbaa
child 467088 11a210eb29b310f97d8b0c18ee6ca32ed7076428
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1445109
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1445109 [wpt PR 9986] - ResourceTiming Issue 138: initiatorType test cases, a=testonly Automatic update from web-platform-testsMerge pull request #9986 from nicjansma/resource-timing-issue-138 ResourceTiming Issue 138: initiatorType test cases wpt-commits: 2e8da45fc4354dc6110b2fefe43be32dee0ecba4 wpt-pr: 9986 wpt-commits: 2e8da45fc4354dc6110b2fefe43be32dee0ecba4 wpt-pr: 9986
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/resource-timing/resource_frame_initiator_type.html
testing/web-platform/tests/resource-timing/resource_initiator_types.html
testing/web-platform/tests/resource-timing/resources/all_resource_types.htm
testing/web-platform/tests/resource-timing/resources/empty.py
testing/web-platform/tests/resource-timing/resources/eventsource.py
testing/web-platform/tests/resource-timing/resources/green_frame.htm
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -290379,21 +290379,31 @@
      {}
     ]
    ],
    "resource-timing/resources/empty.js": [
     [
      {}
     ]
    ],
+   "resource-timing/resources/empty.py": [
+    [
+     {}
+    ]
+   ],
    "resource-timing/resources/empty_script.js": [
     [
      {}
     ]
    ],
+   "resource-timing/resources/eventsource.py": [
+    [
+     {}
+    ]
+   ],
    "resource-timing/resources/fake_responses.html": [
     [
      {}
     ]
    ],
    "resource-timing/resources/fake_responses.py": [
     [
      {}
@@ -359457,22 +359467,16 @@
     ]
    ],
    "resource-timing/resource_dynamic_insertion.html": [
     [
      "/resource-timing/resource_dynamic_insertion.html",
      {}
     ]
    ],
-   "resource-timing/resource_frame_initiator_type.html": [
-    [
-     "/resource-timing/resource_frame_initiator_type.html",
-     {}
-    ]
-   ],
    "resource-timing/resource_ignore_data_url.html": [
     [
      "/resource-timing/resource_ignore_data_url.html",
      {}
     ]
    ],
    "resource-timing/resource_ignore_failures.html": [
     [
@@ -590956,30 +590960,26 @@
   "resource-timing/resource_dedicated_worker.html": [
    "8a4f853bdffe110bc15c04aaed4d4436a5ea3a23",
    "testharness"
   ],
   "resource-timing/resource_dynamic_insertion.html": [
    "a6cd75583f6363a83b18f1bc77d89821de344ff7",
    "testharness"
   ],
-  "resource-timing/resource_frame_initiator_type.html": [
-   "dcea1111a2c9a40a1d3de7246a5295e84dcf08b5",
-   "testharness"
-  ],
   "resource-timing/resource_ignore_data_url.html": [
    "f8513b4ae7cc26c07cea1c16d872e0594f05041c",
    "testharness"
   ],
   "resource-timing/resource_ignore_failures.html": [
    "c22e136e1c942a2fd652985a660ca0acd6c3a8b6",
    "testharness"
   ],
   "resource-timing/resource_initiator_types.html": [
-   "70ab5e0b5d8d684fc420e9242a273e948edbb1ba",
+   "11ad45e383c110eee2496c481abbff9642f6e6ee",
    "testharness"
   ],
   "resource-timing/resource_memory_cached.sub.html": [
    "7bd3af7679a4e628090bbc1e7114f416457144d6",
    "testharness"
   ],
   "resource-timing/resource_redirects.html": [
    "76f977ff494e0c7899b616909b0dab1832ed44c5",
@@ -591025,45 +591025,53 @@
    "dfbd67c249b48f133ec896a291ea0d925307e4ec",
    "testharness"
   ],
   "resource-timing/resources/TAOResponse.py": [
    "9e8051a2ff8fff72b36ed1cecb61f9e7bba29071",
    "support"
   ],
   "resource-timing/resources/all_resource_types.htm": [
-   "c7f698888c64e5b750fac45e22dbb85e5979b3c5",
+   "63a40f0ab7e27536448a7624bb632332c9d0aae4",
    "support"
   ],
   "resource-timing/resources/blank_page_green.htm": [
    "2d6d55d85e17a9fe978db6dbe25ae35a599d5683",
    "support"
   ],
   "resource-timing/resources/blue.png": [
    "99949c515749e66f471c3589ee7a0ef518aaccb5",
    "support"
   ],
   "resource-timing/resources/empty.js": [
    "51e0050cf1bdeb051d0d7ab6f23a7a2173cb40db",
    "support"
   ],
+  "resource-timing/resources/empty.py": [
+   "3638ba60904616a2bf551fef1fb81b08db9e172f",
+   "support"
+  ],
   "resource-timing/resources/empty_script.js": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
+  "resource-timing/resources/eventsource.py": [
+   "e53940d9844b03cd06b425530e2e23e20aa31bdb",
+   "support"
+  ],
   "resource-timing/resources/fake_responses.html": [
    "c942abc1e8c1672935ffc8ce34821891345bacb9",
    "support"
   ],
   "resource-timing/resources/fake_responses.py": [
    "09568d5f64474184cde594a47e26e374bcc8ac4d",
    "support"
   ],
   "resource-timing/resources/green_frame.htm": [
-   "08f8ca19b61ab0ac68014d5b406a952669fbe104",
+   "710159d2dcfce2cdc2f98449ec7a516fdc739079",
    "support"
   ],
   "resource-timing/resources/gzip_xml.py": [
    "cf637a4389fd259dee3a2df56194a68b3744b4c6",
    "support"
   ],
   "resource-timing/resources/iframe_TAO_match_origin.html": [
    "9a3adace2991c7bd1876a904b6c4389633b9828f",
deleted file mode 100644
--- a/testing/web-platform/tests/resource-timing/resource_frame_initiator_type.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8" />
-<title>Resource Timing frame initiator type</title>
-<link rel="author" title="Google" href="http://www.google.com/" />
-<link rel="help" href="http://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/webperftestharness.js"></script>
-<script src="resources/webperftestharnessextension.js"></script>
-<script>
-setup({explicit_done: true});
-
-function onload_test() {
-    const iframe = document.getElementById('frameContext');
-    const context = new PerformanceContext(iframe.contentWindow.performance);
-    const entries = context.getEntriesByType('resource');
-
-    const index = window.location.pathname.lastIndexOf('/');
-    const pathname = window.location.pathname.substring(0, index) +
-      '/resources/blank_page_green.htm';
-    const expected_entries = {};
-    expected_entries[pathname] = 'frame';
-
-    test_resource_entries(entries, expected_entries);
-    done();
-}
-</script>
-</head>
-<body>
-<h1>Description</h1>
-<p>This test validates that the frame initiator type is represented.</p>
-<div id="log"></div>
-<iframe id="frameContext" onload="onload_test();" src="resources/green_frame.htm" style="width: 250px; height: 250px;"></iframe>
-</body>
-</html>
--- a/testing/web-platform/tests/resource-timing/resource_initiator_types.html
+++ b/testing/web-platform/tests/resource-timing/resource_initiator_types.html
@@ -13,25 +13,26 @@
 setup({explicit_done: true, timeout: 30000});
 
 let background_loaded = false;
 let page_loaded = false;
 let ol_font_loaded = false;
 let ul_font_loaded = false;
 let xhr_loaded = false;
 let tests_run = false;
+let frameset_loaded = false;
 
 function check_finished() {
     if (!ul_font_loaded) {
         ul_font_loaded = check_font_loaded('ul');
     }
     if (!ol_font_loaded) {
         ol_font_loaded = check_font_loaded('ol');
     }
-    if (page_loaded && ol_font_loaded && ul_font_loaded && background_loaded && xhr_loaded) {
+    if (page_loaded && ol_font_loaded && ul_font_loaded && background_loaded && xhr_loaded && frameset_loaded) {
         perform_test();
     } else {
         step_timeout(check_finished, 100);
     }
 }
 
 function check_font_loaded(type) {
     const width_var_name = 'original_width_' + type;
@@ -59,56 +60,105 @@ function onload_test() {
         image.onload = function() {
             background_loaded = true;
         }
     }
 
     step_timeout(check_finished, 100);
 }
 
+function frameset_onload() {
+    frameset_loaded = true;
+
+    step_timeout(check_finished, 100);
+}
+
 function perform_test() {
     if (tests_run) {
         return;
     }
     tests_run = true;
     const context = new PerformanceContext(document.getElementById('frameContext').contentWindow.performance);
-    const entries = context.getEntriesByType('resource');
+    let entries = context.getEntriesByType('resource');
+
+    // check for frameset
+    if (document.getElementById('frameContext2') &&
+        document.getElementById('frameContext2').contentWindow) {
+        const context2 = new PerformanceContext(document.getElementById('frameContext2').contentWindow.performance);
+        entries = entries.concat(context2.getEntriesByType('resource'));
+    }
 
     const index = window.location.pathname.lastIndexOf('/');
     const pathname = window.location.pathname.substring(0, index) + '/resources/';
     const font_pathname = window.location.pathname.substring(0, index - 15) + 'fonts/Ahem.ttf';
 
     let expected_entries = {};
-    expected_entries[font_pathname] = 'css';
-    expected_entries[pathname + 'resource_timing_test0.png'] = 'img';
-    expected_entries[pathname + 'blank_page_green.htm'] = 'iframe';
-    expected_entries[pathname + 'empty_script.js'] = 'script';
-    expected_entries[pathname + 'resource_timing_test0.css?id=embed'] = 'embed';
-    expected_entries[pathname + 'resource_timing_test0.css?id=n1'] = 'css';
-    expected_entries[font_pathname + '?id=n1'] = 'css';
-    expected_entries[pathname + 'blue.png?id=1'] = 'css';
-    expected_entries[pathname + 'blue.png?id=2'] = 'css';
-    expected_entries[pathname + 'blue.png?id=async_xhr'] = 'xmlhttprequest';
-    expected_entries[pathname + 'blue.png?id=body'] = 'body';
-    expected_entries[pathname + 'blue.png?id=input'] = 'input';
-    expected_entries[pathname + 'blue.png?id=n1'] = 'css';
-    expected_entries[pathname + 'blue.png?id=object'] = 'object';
-    expected_entries[pathname + 'blue.png?id=poster'] = 'video';
-    expected_entries[pathname + 'nested.css'] = 'link';
+    addEntryIfExists(entries, expected_entries, font_pathname, 'css');
+    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.png', 'img');
+    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.png?id=srcset-srcset', 'img');
+    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.png?id=srcset-src', 'img');
+    addEntryIfExists(entries, expected_entries, pathname + 'blank_page_green.htm', 'iframe');
+    addEntryIfExists(entries, expected_entries, pathname + 'blank_page_green.htm?id=frame', 'frame');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty_script.js', 'script');
+    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.css?id=embed', 'embed');
+    addEntryIfExists(entries, expected_entries, pathname + 'resource_timing_test0.css?id=n1', 'css');
+    addEntryIfExists(entries, expected_entries, font_pathname + '?id=n1', 'css');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=cursor', 'css');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=1', 'css');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=2', 'css');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=async_xhr', 'xmlhttprequest');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=body', 'body');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=input', 'input');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=n1', 'css');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=object', 'object');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=video-poster', 'video');
+    addEntryIfExists(entries, expected_entries, '/media/test.mp4?id=video-src', 'video');
+    addEntryIfExists(entries, expected_entries, '/media/test.mp4?id=video-source', 'source');
+    addEntryIfExists(entries, expected_entries, '/media/test.ogg?id=video-source', 'source');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=video-track', 'track');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=audio-src', 'audio');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=audio-source-wav', 'source');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=audio-source-mpeg', 'source');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=audio-source-ogg', 'source');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-source', 'source');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-img', 'img');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-notsupported-img', 'img');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-img-src', 'img');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-img-srcset', 'img');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=picture-99x-img-src', 'img');
+    addEntryIfExists(entries, expected_entries, pathname + 'blue.png?id=svg-image', 'image');
+    addEntryIfExists(entries, expected_entries, pathname + 'nested.css', 'link');
+    addEntryIfExists(entries, expected_entries, pathname + 'nested.css?id=prefetch', 'link');
+    addEntryIfExists(entries, expected_entries, pathname + 'nested.css?id=preload', 'link');
+    addEntryIfExists(entries, expected_entries, pathname + 'blank_page_green.htm?id=prerender', 'link');
+    addEntryIfExists(entries, expected_entries, pathname + 'manifest.json', 'link');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=beacon', 'beacon');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?id=fetch', 'fetch');
+    addEntryIfExists(entries, expected_entries, pathname + 'empty.py?favicon', 'link');
+    addEntryIfExists(entries, expected_entries, pathname + 'eventsource.py?id=eventsource', 'eventsource');
 
     test_resource_entries(entries, expected_entries);
     done();
 }
 
+function addEntryIfExists(entries, expected_entries, path, initiatorType) {
+    const url = window.location.protocol + "//" + window.location.host + path;
+
+    if (entries.find(function(entry) { return entry.name === url; })) {
+        expected_entries[path] = initiatorType;
+    }
+}
+
 window.on_test_body_created = check_finished;
 window.on_async_xhr_done = function() {
     xhr_loaded = true;
     check_finished();
 }
 </script>
 </head>
 <body>
 <h1>Description</h1>
 <p>This test validates that all of the initiator types are represented.</p>
 <div id="log"></div>
 <iframe id="frameContext" onload="onload_test();" src="resources/all_resource_types.htm" style="width: 250px; height: 250px;"></iframe>
+<iframe id="frameContext2" onload="frameset_onload();" src="resources/green_frame.htm" style="width: 250px; height: 250px;"></iframe>
 </body>
 </html>
--- a/testing/web-platform/tests/resource-timing/resources/all_resource_types.htm
+++ b/testing/web-platform/tests/resource-timing/resources/all_resource_types.htm
@@ -1,49 +1,107 @@
 <!DOCTYPE HTML>
 <html>
     <head>
         <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
         <title>All Resource Types Test Page</title>
+        <link rel="shortcut icon" href="empty.py?favicon">
     </head>
     <body background='blue.png?id=body'>
         <script>
             if (window.parent.hasOwnProperty('on_test_body_created'))
                 window.parent.on_test_body_created();
         </script>
         <link rel="stylesheet" href="nested.css"></link>
+        <link rel="prefetch" href="nested.css?id=prefetch"></link>
+        <link rel="preload" href="nested.css?id=preload" as="style"></link>
+        <link rel="prerender" href="blank_page_green.htm?id=prerender"></link>
+        <link rel="manifest" href="manifest.json"></link>
         <img src="resource_timing_test0.png"></img>
+        <img src="resource_timing_test0.png?id=srcset-src"
+            srcset="resource_timing_test0.png?id=srcset-srcset 67w"
+            sizes="67px"></img>
         <iframe src="blank_page_green.htm" width="100px" height="100px"></iframe>
         <script src="empty_script.js"></script>
         <script>
             var async_xhr = new XMLHttpRequest;
             async_xhr.open('GET', 'blue.png?id=async_xhr', true);
             async_xhr.onreadystatechange = function() {
                 if (async_xhr.readyState == 4 && async_xhr.status == 200 && parent.hasOwnProperty('on_async_xhr_done'))
                     parent.on_async_xhr_done();
             }
             async_xhr.send();
+
+            if (window.navigator && navigator.sendBeacon) {
+                navigator.sendBeacon('empty.py?id=beacon');
+            }
+
+            if (window.fetch) {
+                fetch('empty.py?id=fetch');
+            }
+
+            if (window.EventSource) {
+                var evtSource = new EventSource('eventsource.py?id=eventsource');
+            }
         </script>
         <style>
             @font-face {
                 font-family: remoteFontAhem;
                 src: url('/fonts/Ahem.ttf');
             }
             iframe {
                 background: url('blue.png?id=1');
             }
+            body {
+                cursor: url('blue.png?id=cursor'), pointer;
+            }
             ul {
                 font-family: remoteFontAhem;
                 list-style-image: url('blue.png?id=2');
             }
         </style>
         <ul>
             <li>Test</li>
         </ul>
         <ol>
             <li>Test</li>
         </ol>
         <embed src="resource_timing_test0.css?id=embed" type="text/css"></embed>
         <input type="image" src="blue.png?id=input"></input>
         <object type="image/png" data="blue.png?id=object"></object>
-        <video poster="blue.png?id=poster"></video>
+        <video poster="blue.png?id=video-poster"></video>
+        <video src="/media/test.mp4?id=video-src" autoplay="true"></video>
+        <video autoplay="true">
+            <source src="/media/test.mp4?id=video-source" type="video/mp4">
+            <source src="/media/test.ogv?id=video-source" type="video/ogg">
+            <track kind="subtitles" src="empty.py?id=video-track" srclang="en" default>
+        </video>
+        <audio src="empty.py?id=audio-src"></audio>
+        <audio>
+            <source src="empty.py?id=audio-source-wav" type="audio/wav" />
+            <source src="empty.py?id=audio-source-mpeg" type="audio/mpeg" />
+            <source src="empty.py?id=audio-source-ogg" type="audio/ogg" />
+        </audio>
+        <svg width=200 height=200
+            xmlns="http://www.w3.org/2000/svg"
+            xmlns:xlink="http://www.w3.org/1999/xlink">
+            <image href="blue.png?id=svg-image" height="200" width="200"/>
+        </svg>
+        <picture>
+            <source srcset="blue.png?id=picture-source" type="image/png" />
+            <img src="blue.png?id=picture-img" />
+        </picture>
+        <picture>
+            <source srcset="blue.png?id=picture-notsupported-source" type="image/notsupported" />
+            <img src="blue.png?id=picture-notsupported-img" />
+        </picture>
+        <picture>
+            <img src="blue.png?id=picture-img-src"
+                srcset="blue.png?id=picture-img-srcset"
+                sizes="67px"></img>
+        </picture>
+        <picture>
+            <img src="blue.png?id=picture-99x-img-src"
+                srcset="blue.png?id=picture-99x-img-srcset 99x"
+                sizes="67px"></img>
+        </picture>
     </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resources/empty.py
@@ -0,0 +1,3 @@
+def main(request, response):
+    response.headers.set("Content-Type", "text/plain")
+    return ""
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resources/eventsource.py
@@ -0,0 +1,3 @@
+def main(request, response):
+    response.headers.set("Content-Type", "text/event-stream")
+    return ""
--- a/testing/web-platform/tests/resource-timing/resources/green_frame.htm
+++ b/testing/web-platform/tests/resource-timing/resources/green_frame.htm
@@ -1,7 +1,7 @@
 <html>
   <head>
     <frameset>
-      <frame src="blank_page_green.htm">
+      <frame src="blank_page_green.htm?id=frame">
     </frameset>
   </head>
 </html>