OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>effective media volume</title> | 2 <title>effective media volume</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <div id="log"></div> | 5 <div id="log"></div> |
6 <script> | 6 <script> |
7 [0, 0.5, 1].forEach(function(volume) | 7 [0, 0.5, 1].forEach(function(volume) |
8 { | 8 { |
9 [false, true].forEach(function(muted) | 9 [false, true].forEach(function(muted) |
10 { | 10 { |
11 test(function() | 11 test(function() |
12 { | 12 { |
13 var audio = new Audio(); | 13 var audio = new Audio(); |
14 audio.volume = volume; | 14 audio.volume = volume; |
15 audio.muted = muted; | 15 audio.muted = muted; |
16 assert_equals(internals.effectiveMediaVolume(audio), | 16 assert_equals(internals.effectiveMediaVolume(audio), |
17 volume * (muted ? 0 : 1)); | 17 volume * (muted ? 0 : 1)); |
18 }, "volume: " + volume + ", muted: " + muted); | 18 }, "volume: " + volume + ", muted: " + muted); |
19 | |
20 [0, 0.5, 1].forEach(function(controllerVolume) | |
21 { | |
22 [false, true].forEach(function(controllerMuted) | |
23 { | |
24 test(function() | |
25 { | |
26 var audio = new Audio(); | |
27 audio.volume = volume; | |
28 audio.muted = muted; | |
29 var controller = new MediaController(); | |
30 controller.volume = controllerVolume; | |
31 controller.muted = controllerMuted; | |
32 audio.controller = controller; | |
33 assert_equals(internals.effectiveMediaVolume(audio), | |
34 volume * (muted ? 0 : 1) * controllerVolume *
(controllerMuted ? 0 : 1)); | |
35 }, "volume: " + volume + ", muted: " + muted + ", controller vol
ume: " + controllerVolume + ", controller muted: " + controllerMuted); | |
36 }); | |
37 }); | |
38 }); | 19 }); |
39 }); | 20 }); |
40 </script> | 21 </script> |
OLD | NEW |