3 <title>Media Capture Depth Dictionary Test
</title>
4 <link rel=
"author" title=
"Intel" href=
"http://www.intel.com">
5 <link rel=
"help" href=
"https://w3c.github.io/mediacapture-depth/#extensions">
6 <script src=
"/resources/testharness.js"></script>
7 <script src=
"/resources/testharnessreport.js"></script>
8 <script src=
"dictionary-helper.js"></script>
9 <meta name=
"flags" content=
"interact">
11 <h2>Preconditions
</h2>
14 Use a test device with depth camera(embedded or external).
17 When prompted, accept to share your depth/color(RGB) stream.
25 let advanced_constraints_depth
= [{
29 let advanced_constraints_color
= [{
33 function validateMediaTrackCapabilities(capabilities
, type
) {
34 assert_string_field(capabilities
, 'videoKind');
38 function validateMediaTrackConstraintSet(constraints
, type
) {
39 assert_constrain_string_field(constraints
, 'videoKind');
42 function validateMediaTrackSettings(settings
, type
) {
43 assert_string_field(settings
, 'videoKind');
44 assert_enum_field(settings
, 'videoKind', ['color', 'depth'])
47 function validateMediaTrackSupportedConstraints(supports
) {
48 assert_boolean_field(supports
, 'videoKind', true);
51 function runDictionaryTests(type
, constraints
) {
53 return navigator
.mediaDevices
.getUserMedia({video
: {advanced
: constraints
}})
55 let capabilities
= stream
.getTracks()[0].getCapabilities();
56 validateMediaTrackCapabilities(capabilities
, type
);
58 }, `MediaTrackCapabilities dictionary of ${type} include attributes are correct`);
61 return navigator
.mediaDevices
.getUserMedia({video
: {advanced
: constraints
}})
63 let constraints
= stream
.getTracks()[0].getConstraints()["advanced"][0];
64 validateMediaTrackConstraintSet(constraints
);
66 }, `MediaTrackConstraintSet dictionary of ${type} include attributes are correct`);
69 return navigator
.mediaDevices
.getUserMedia({video
: {advanced
: constraints
}})
71 let settings
= stream
.getTracks()[0].getSettings();
72 validateMediaTrackSettings(settings
, type
);
74 }, `MediaTrackSettings dictionary of ${type} include attributes are correct`);
78 let supports
= navigator
.mediaDevices
.getSupportedConstraints();
79 validateMediaTrackSupportedConstraints(supports
);
80 }, "MediaTrackSupportedConstraints dictionary include attributes are correct");
82 runDictionaryTests("depth", advanced_constraints_depth
);
83 runDictionaryTests("color", advanced_constraints_color
);