summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_eme_stream_capture_blocked_case1.html
blob: 61e8d673f37860a901f08a44c11b46800e5d196a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE HTML>
<html>
<head>
  <title>Test Encrypted Media Extensions</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="manifest.js"></script>
  <script type="text/javascript" src="eme.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var manager = new MediaTestManager;

function startTest(test, token)
{
  // Three cases:
  // 1. setting MediaKeys on an element captured by MediaElementSource should fail, and
  // 2. creating a MediaElementSource on a media element with a MediaKeys should fail, and
  // 3. capturing a media element with mozCaptureStream that has a MediaKeys should fail.

  // Case 1. setting MediaKeys on an element captured by MediaElementSource should fail.
  var case1token = token + "_case1";
  var setKeysFailed = function() {
    ok(true, TimeStamp(case1token) + " setMediaKeys failed as expected.");
    manager.finished(case1token);
  };
  var v1 = SetupEME(test, case1token,  { onSetKeysFail: setKeysFailed });
  var context = new AudioContext();
  var node = context.createMediaElementSource(v1);
  v1.addEventListener("loadeddata", function(ev) {
    ok(false, TimeStamp(case1token) + " should never reach loadeddata, as setMediaKeys should fail");
  });
  manager.started(case1token);
  LoadTestWithManagedLoadToken(test, v1, manager, case1token,
                               { onlyLoadFirstFragments:2, noEndOfStream:false });
}

function beginTest() {
  manager.runTests(gEMETests, startTest);
}

if (!IsMacOSSnowLeopardOrEarlier()) {
  SimpleTest.waitForExplicitFinish();
  SetupEMEPref(beginTest);
} else {
  todo(false, "Test disabled on this platform.");
}
</script>
</pre>
</body>
</html>