Bug 1509310 [wpt PR 14181] - Media Capabilities: switch MediaCapabilitiesInfo to a dictionary., a=testonly
authorMounir Lamouri <mlamouri@chromium.org>
Fri, 30 Nov 2018 18:01:14 +0000
changeset 449999 6a3c745ff36ea04be5a1077b51fe3807d989086d
parent 449998 a517bb8630aa8c1b305a2a8bb7a5787b8be18ff4
child 450000 56c3ad4bde5c70714b784ccf15d099e0df0f5bde
push id35189
push userccoroiu@mozilla.com
push dateTue, 11 Dec 2018 21:33:05 +0000
treeherdermozilla-central@ac7f3beb6333 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1509310, 14181, 907704, 1347001, 610655
milestone66.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 1509310 [wpt PR 14181] - Media Capabilities: switch MediaCapabilitiesInfo to a dictionary., a=testonly Automatic update from web-platform-tests Media Capabilities: switch MediaCapabilitiesInfo to a dictionary. This required to create a custom callback class as CallbackPromiseAdapter does not work well with dictionaries. This is also updating the media-capabilities.idl file in WPT, based on: https://raw.githubusercontent.com/tidoust/reffy-reports/master/whatwg/idl/media-capabilities.idl Bug: 907704 Change-Id: I13bb3c43a7461398f7866f033527bd3ce1bed140 Reviewed-on: https://chromium-review.googlesource.com/c/1347001 Commit-Queue: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: Philip J├Ągenstedt <foolip@chromium.org> Cr-Commit-Position: refs/heads/master@{#610655} -- wpt-commits: c7a5c87e5c315051c40c6769952214f5c819df93 wpt-pr: 14181
testing/web-platform/tests/interfaces/media-capabilities.idl
testing/web-platform/tests/media-capabilities/decodingInfo.html
testing/web-platform/tests/media-capabilities/encodingInfo.html
testing/web-platform/tests/media-capabilities/idlharness.any.js
--- a/testing/web-platform/tests/interfaces/media-capabilities.idl
+++ b/testing/web-platform/tests/interfaces/media-capabilities.idl
@@ -5,16 +5,17 @@
 
 dictionary MediaConfiguration {
   VideoConfiguration video;
   AudioConfiguration audio;
 };
 
 dictionary MediaDecodingConfiguration : MediaConfiguration {
   required MediaDecodingType type;
+  MediaCapabilitiesKeySystemConfiguration keySystemConfiguration;
 };
 
 dictionary MediaEncodingConfiguration : MediaConfiguration {
   required MediaEncodingType type;
 };
 
 enum MediaDecodingType {
   "file",
@@ -36,36 +37,50 @@ dictionary VideoConfiguration {
 
 dictionary AudioConfiguration {
   required DOMString contentType;
   DOMString channels;
   unsigned long long bitrate;
   unsigned long samplerate;
 };
 
-[Exposed=(Window, Worker)]
-interface MediaCapabilitiesInfo {
-  readonly attribute boolean supported;
-  readonly attribute boolean smooth;
-  readonly attribute boolean powerEfficient;
+dictionary MediaCapabilitiesKeySystemConfiguration {
+    required DOMString keySystem;
+    DOMString initDataType = "";
+    DOMString audioRobustness = "";
+    DOMString videoRobustness = "";
+    MediaKeysRequirement distinctiveIdentifier = "optional";
+    MediaKeysRequirement persistentState = "optional";
+    sequence<DOMString> sessionTypes;
+  };
+
+dictionary MediaCapabilitiesInfo {
+  required boolean supported;
+  required boolean smooth;
+  required boolean powerEfficient;
+
+};
+
+dictionary MediaCapabilitiesDecodingInfo : MediaCapabilitiesInfo {
+  required MediaKeySystemAccess keySystemAccess;
 };
 
 [Exposed=Window]
 partial interface Navigator {
   [SameObject] readonly attribute MediaCapabilities mediaCapabilities;
 };
 
 [Exposed=Worker]
 partial interface WorkerNavigator {
   [SameObject] readonly attribute MediaCapabilities mediaCapabilities;
 };
 
 [Exposed=(Window, Worker)]
 interface MediaCapabilities {
-  [NewObject] Promise<MediaCapabilitiesInfo> decodingInfo(MediaDecodingConfiguration configuration);
+  [NewObject] Promise<MediaCapabilitiesDecodingInfo> decodingInfo(MediaDecodingConfiguration configuration);
   [NewObject] Promise<MediaCapabilitiesInfo> encodingInfo(MediaEncodingConfiguration configuration);
 };
 
 interface ScreenLuminance {
   readonly attribute double min;
   readonly attribute double max;
   readonly attribute double maxAverage;
 };
--- a/testing/web-platform/tests/media-capabilities/decodingInfo.html
+++ b/testing/web-platform/tests/media-capabilities/decodingInfo.html
@@ -278,19 +278,19 @@ promise_test(t => {
 }, "Test that decodingInfo rejects if the audio configuration contentType has one parameter that isn't codecs");
 
 promise_test(t => {
   return navigator.mediaCapabilities.decodingInfo({
     type: 'file',
     video: minimalVideoConfiguration,
     audio: minimalAudioConfiguration,
   }).then(ability => {
-    assert_idl_attribute(ability, 'supported');
-    assert_idl_attribute(ability, 'smooth');
-    assert_idl_attribute(ability, 'powerEfficient');
+    assert_equals(typeof ability.supported, "boolean");
+    assert_equals(typeof ability.smooth, "boolean");
+    assert_equals(typeof ability.powerEfficient, "boolean");
   });
 }, "Test that decodingInfo returns a valid MediaCapabilitiesInfo objects");
 
 async_test(t => {
   var validTypes = [ 'file', 'media-source' ];
   var invalidTypes = [ undefined, null, '', 'foobar', 'mse', 'MediaSource',
                        'record', 'transmission' ];
 
--- a/testing/web-platform/tests/media-capabilities/encodingInfo.html
+++ b/testing/web-platform/tests/media-capabilities/encodingInfo.html
@@ -1,10 +1,10 @@
 <!DOCTYPE html>
-<title>MediaCapabilities.decodingInfo()</title>
+<title>MediaCapabilities.encodingInfo()</title>
 <script src=/resources/testharness.js></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
 
 // Minimal VideoConfiguration that will be allowed per spec. All optional
 // properties are missing.
 var minimalVideoConfiguration = {
   contentType: 'video/webm; codecs="vp09.00.10.08"',
@@ -278,19 +278,19 @@ promise_test(t => {
 }, "Test that encodingInfo rejects if the audio configuration contentType has one parameter that isn't codecs");
 
 promise_test(t => {
   return navigator.mediaCapabilities.encodingInfo({
     type: 'record',
     video: minimalVideoConfiguration,
     audio: minimalAudioConfiguration,
   }).then(ability => {
-    assert_idl_attribute(ability, 'supported');
-    assert_idl_attribute(ability, 'smooth');
-    assert_idl_attribute(ability, 'powerEfficient');
+    assert_equals(typeof ability.supported, "boolean");
+    assert_equals(typeof ability.smooth, "boolean");
+    assert_equals(typeof ability.powerEfficient, "boolean");
   });
 }, "Test that encodingInfo returns a valid MediaCapabilitiesInfo objects");
 
 async_test(t => {
   var validTypes = [ 'record', 'transmission' ];
   var invalidTypes = [ undefined, null, '', 'foobar', 'mse', 'MediaSource',
                        'file', 'media-source', ];
 
--- a/testing/web-platform/tests/media-capabilities/idlharness.any.js
+++ b/testing/web-platform/tests/media-capabilities/idlharness.any.js
@@ -1,46 +1,25 @@
 // META: script=/resources/WebIDLParser.js
 // META: script=/resources/idlharness.js
 
 // https://wicg.github.io/media-capabilities/
 
 'use strict';
 
 promise_test(async () => {
-  try {
-    const video = {
-      contentType: 'video/webm; codecs="vp09.00.10.08"',
-      width: 800,
-      height: 600,
-      bitrate: 3000,
-      framerate: 24,
-    };
-    self.decodingInfo = await navigator.mediaCapabilities.decodingInfo({
-      type: 'file',
-      video: video,
-    });
-    self.encodingInfo = await navigator.mediaCapabilities.encodingInfo({
-      type: 'record',
-      video: video
-    });
-  } catch (e) {
-    // Will be surfaced when encodingInfo/decodingInfo is undefined below.
-  }
-
   idl_test(
     ['media-capabilities'],
     ['html', 'cssom-view'],
     idl_array => {
       if (self.GLOBAL.isWorker()) {
         idl_array.add_objects({ WorkerNavigator: ['navigator'] });
       } else {
         idl_array.add_objects({ Navigator: ['navigator'] });
       }
       idl_array.add_objects({
         MediaCapabilities: ['navigator.mediaCapabilities'],
-        MediaCapabilitiesInfo: ['decodingInfo', 'encodingInfo'],
         Screen: ['screen'],
         ScreenLuminance: ['screen.luminance'],
       });
     }
   );
 });