blob: 8e1cc7b83ac117e21273e82ab17bbfb0fcf94a69 (
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
53
54
55
56
57
58
59
|
<!DOCTYPE html>
<meta charset="utf-8">
<title>Presentation API, start new presentation tests for Controlling User Agent (success - manual test)</title>
<link rel="author" title="Marius Wessel" href="http://www.fokus.fraunhofer.de">
<link rel="help" href="http://w3c.github.io/presentation-api/#dfn-controlling-user-agent">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>Click the button below and select the available casting device, to start the manual test.</p>
<button id="presentBtn" onclick="startPresentation()">Start Presentation Test</button>
<script>
// ----------
// DOM Object
// ----------
var presentBtn = document.getElementById("presentBtn");
// ------------
// Request init
// ------------
var validUnixDate = new Date().getTime() + String(Math.floor(Math.random() * 1e5)),
validPresURL = '../receiving-ua/idlharness.html#__castAppId__=2334D33A/__castClientId__=' + validUnixDate,
request = new PresentationRequest(validPresURL);
// ---------------------------------------------
// Start New Presentation Test (success) - begin
// ---------------------------------------------
var startPresentation = function () {
promise_test(function () {
return request.start()
.then(function (connection) {
// assert case for the promise_test
assert_equals(connection.state, "connected", "The presentation has an connected state.");
// Check, if the connection ID is set
test(function () {
assert_true(!!connection.id);
}, 'The connection ID is set.');
// Check the type of the connection.id
test(function () {
assert_true(typeof connection.id === 'string');
}, 'The connection ID is a string.');
// Check the instance of the connection
test(function () {
assert_true(connection instanceof PresentationConnection);
}, 'The connection is an instance of PresentationConnection.');
});
}, "The presentation was started successfully.");
}
// -------------------------------------------
// Start New Presentation Test (success) - end
// -------------------------------------------
</script>
|