Bug 1465573 [wpt PR 11253] - Move mediasession IDL to interfaces, a=testonly
authorChris Nardi <christopherncarmel@hotmail.com>
Wed, 06 Jun 2018 16:54:59 +0000
changeset 478952 2bdd8719b40d299ec978a47f4615b5916576a034
parent 478951 a5efb452762ccfe7d675d60f85604220a442e679
child 478953 9f044aca749d4e2bd59737b53bb35092665071be
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1465573, 11253
milestone62.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 1465573 [wpt PR 11253] - Move mediasession IDL to interfaces, a=testonly Automatic update from web-platform-testsMove mediasession IDL to interfaces The mediasession IDL was defined directly in the idlharness test. This change moves the IDL definitions into its own file in interfaces. This change also makes the construction of MediaMetadata be quoted, so the test can proceed even if it is not defined. -- wpt-commits: 3299400fe83fc70d0058774d22671e86d366e253 wpt-pr: 11253
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/interfaces/mediasession.idl
testing/web-platform/tests/mediasession/idlharness.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -287249,16 +287249,21 @@
      {}
     ]
    ],
    "interfaces/mediacapture-main.idl": [
     [
      {}
     ]
    ],
+   "interfaces/mediasession.idl": [
+    [
+     {}
+    ]
+   ],
    "interfaces/orientation-sensor.idl": [
     [
      {}
     ]
    ],
    "interfaces/payment-handler.idl": [
     [
      {}
@@ -581166,16 +581171,20 @@
   "interfaces/media-capabilities.idl": [
    "17413896d6281553091cf2c369c29de42d450962",
    "support"
   ],
   "interfaces/mediacapture-main.idl": [
    "3400c775504ebf32af3f8e1165a53ca60f258495",
    "support"
   ],
+  "interfaces/mediasession.idl": [
+   "7cbe73f7f563ee45772bb466ce63e16a549548d3",
+   "support"
+  ],
   "interfaces/orientation-sensor.idl": [
    "1f0698a8611726b1ba724a5d7a0961e836c7b07e",
    "support"
   ],
   "interfaces/payment-handler.idl": [
    "6d9157e515e419c7a2fffc61a1f8e3b23a4550ba",
    "support"
   ],
@@ -582831,17 +582840,17 @@
    "4704befc950341a16c061872e3d57fe9f0f743bf",
    "support"
   ],
   "mediasession/README.md": [
    "5ceecb2611837e6c52a303cec32d8cb9fabe93a6",
    "support"
   ],
   "mediasession/idlharness.html": [
-   "8db3276ecfd3f02e55b89171f61e45e6af540614",
+   "96a3bd3eb15a373ca1c68d528ff6514b3d7cddc1",
    "testharness"
   ],
   "mediasession/mediametadata.html": [
    "0f0c1f7e3b58321a76229fa5a93e80b6863f181f",
    "testharness"
   ],
   "mediasession/playbackstate.html": [
    "e9edd18778d437b039bc45f2e3f35db725528447",
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/interfaces/mediasession.idl
@@ -0,0 +1,49 @@
+[Exposed=Window]
+partial interface Navigator {
+  [SameObject] readonly attribute MediaSession mediaSession;
+};
+
+enum MediaSessionPlaybackState {
+  "none",
+  "paused",
+  "playing"
+};
+
+enum MediaSessionAction {
+  "play",
+  "pause",
+  "seekbackward",
+  "seekforward",
+  "previoustrack",
+  "nexttrack",
+};
+
+callback MediaSessionActionHandler = void();
+
+[Exposed=Window]
+interface MediaSession {
+  attribute MediaMetadata? metadata;
+  attribute MediaSessionPlaybackState playbackState;
+  void setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler);
+};
+
+[Constructor(optional MediaMetadataInit init), Exposed=Window]
+interface MediaMetadata {
+  attribute DOMString title;
+  attribute DOMString artist;
+  attribute DOMString album;
+  attribute FrozenArray<MediaImage> artwork;
+};
+
+dictionary MediaMetadataInit {
+  DOMString title = "";
+  DOMString artist = "";
+  DOMString album = "";
+  sequence<MediaImage> artwork = [];
+};
+
+dictionary MediaImage {
+  required USVString src;
+  DOMString sizes = "";
+  DOMString type = "";
+};
--- a/testing/web-platform/tests/mediasession/idlharness.html
+++ b/testing/web-platform/tests/mediasession/idlharness.html
@@ -6,84 +6,34 @@
 <link rel="help" href="https://wicg.github.io/mediasession/"/>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/WebIDLParser.js"></script>
 <script src="/resources/idlharness.js"></script>
 </head>
 <body>
 <h1>Media Session IDL tests</h1>
-
-<pre id='untested_idl' style='display:none'>
-[Global=Window, Exposed=Global]
-interface Window {
-};
-
-interface Navigator {
-};
-</pre>
-
-<pre id='idl'>
-[Exposed=Window]
-partial interface Navigator {
-  [SameObject] readonly attribute MediaSession mediaSession;
-};
-
-enum MediaSessionPlaybackState {
-  "none",
-  "paused",
-  "playing"
-};
-
-enum MediaSessionAction {
-  "play",
-  "pause",
-  "seekbackward",
-  "seekforward",
-  "previoustrack",
-  "nexttrack",
-};
-
-callback MediaSessionActionHandler = void();
+<script>
+"use strict";
 
-[Exposed=Window]
-interface MediaSession {
-  attribute MediaMetadata? metadata;
-
-  attribute MediaSessionPlaybackState playbackState;
-
-  void setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler);
-};
-
-[Constructor(optional MediaMetadataInit init), Exposed=Window]
-interface MediaMetadata {
-  attribute DOMString title;
-  attribute DOMString artist;
-  attribute DOMString album;
-  attribute FrozenArray<MediaImage> artwork;
-};
+function doTest([mediasession]) {
+    var idl_array = new IdlArray();
+    idl_array.add_untested_idls('interface Navigator {};');
+    idl_array.add_idls(mediasession);
+    idl_array.add_objects({
+      MediaMetadata: ["new MediaMetadata()"],
+      Navigator: ["navigator"]
+    });
+    idl_array.test();
+}
 
-dictionary MediaMetadataInit {
-  DOMString title = "";
-  DOMString artist = "";
-  DOMString album = "";
-  sequence<MediaImage> artwork = [];
-};
+function fetchText(url) {
+    return fetch(url).then((response) => response.text());
+}
 
-dictionary MediaImage {
-  required USVString src;
-  DOMString sizes = "";
-  DOMString type = "";
-};
-</pre>
-<script>
-var idl_array = new IdlArray();
-idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
-idl_array.add_idls(document.getElementById("idl").textContent);
-idl_array.add_objects({
-  MediaMetadata: [new MediaMetadata()],
-  Navigator: ["navigator"]
-});
-idl_array.test();
+promise_test(() => {
+    return Promise.all(["/interfaces/mediasession.idl"].map(fetchText))
+                  .then(doTest);
+}, "Test IDL implementation of Media Session");
 </script>
 <div id="log"></div>
 </body>
 </html>