mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
3
testing/web-platform/tests/presentation-api/OWNERS
Normal file
3
testing/web-platform/tests/presentation-api/OWNERS
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
@louaybassbouss
|
||||
@tidoust
|
||||
@zqzhang
|
||||
24
testing/web-platform/tests/presentation-api/README.md
Normal file
24
testing/web-platform/tests/presentation-api/README.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Presentation API Tests
|
||||
|
||||
This test suite is currently tracking the [Editor Draft][editor-draft] of the Presentation API. The Presentation API describes the [conformance criteria for two classes of user agents][conformance-classes] ([controlling user agent][dfn-controlling-user-agent] and [receiving user agent][dfn-receiving-user-agent]). Each of the two subfolders [controlling-ua](./controlling-ua) and [receiving-ua](./receiving-ua) contains the Presentation API tests for each class of user agents.
|
||||
|
||||
## IDL Tests
|
||||
|
||||
Each of the [controlling-ua](./controlling-ua) and [receiving-ua](./receiving-ua) subfolders contains a file `idlharness.html` that defines IDL tests of the Presentation API for controlling and receiving user agents. The WebIDL of the Presentation API spec is extracted from the [Editor Draft][editor-draft] by running the following JavaScript code in the Dev. console of the Browser.
|
||||
|
||||
```javascript
|
||||
(function(){
|
||||
var s = "";
|
||||
[].forEach.call(document.getElementsByClassName("idl"), function(idl) {
|
||||
if (!idl.classList.contains("extract"))
|
||||
s += idl.textContent + "\n\n";
|
||||
});
|
||||
document.body.innerHTML = '<pre></pre>';
|
||||
document.body.firstChild.textContent = s;
|
||||
})();
|
||||
```
|
||||
|
||||
[editor-draft]: http://w3c.github.io/presentation-api/
|
||||
[conformance-classes]: http://w3c.github.io/presentation-api/#conformance-classes
|
||||
[dfn-controlling-user-agent]: http://w3c.github.io/presentation-api/#dfn-controlling-user-agent
|
||||
[dfn-receiving-user-agent]: http://w3c.github.io/presentation-api/#dfn-receiving-user-agent
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>PresentationConnection.onclose</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<link rel="author" title="He Yue" href="mailto:yue.he@intel.com">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#interface-presentationconnection">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h2>Description</h2>
|
||||
<p>
|
||||
This test validates that after connection close,<br/>
|
||||
the connection state is set closed,<br/>
|
||||
the onclose EventHandler is triggered.
|
||||
</p>
|
||||
<br/>
|
||||
<p>Click the button below to start the test.</p>
|
||||
<button id="presentStartBtn" onclick="startPresentation()">Start Presentation Test</button>
|
||||
|
||||
<script>
|
||||
setup({explicit_timeout: true});
|
||||
var startPresentation = function () {
|
||||
async_test(function(t) {
|
||||
var client_id = String(new Date().getTime()) + String(Math.floor(Math.random() * 1e5));
|
||||
var url = "support/presentation.html#__castAppId__=C2335F62/__castClientId__="+ client_id;
|
||||
var request = new PresentationRequest(url);
|
||||
request.start()
|
||||
.then(function(connection) {
|
||||
assert_true(connection instanceof PresentationConnection, 'the connection is setup');
|
||||
connection.onclose = t.step_func_done(function(evt) {
|
||||
assert_equals(evt.type, "close");
|
||||
assert_equals(connection.state, "closed");
|
||||
});
|
||||
connection.close();
|
||||
})
|
||||
.catch(function(ex) {
|
||||
assert_unreached(ex.name + ":" + ex.message);
|
||||
});
|
||||
}, "the onclose is fired and the connection state is closed.");
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>PresentationConnection.onconnect</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<link rel="author" title="He Yue" href="mailto:yue.he@intel.com">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#interface-presentationconnection">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h2>Description</h2>
|
||||
<p>
|
||||
This test validates that after connection starts,<br/>
|
||||
the onconnect EventHandler is triggered and connection state is connected.
|
||||
</p>
|
||||
<br/>
|
||||
<p>Click the button below to start the test.</p>
|
||||
<button id="presentStartBtn" onclick="startPresentation()">Start Presentation Test</button>
|
||||
|
||||
<script>
|
||||
setup({explicit_timeout: true});
|
||||
var startPresentation = function () {
|
||||
async_test(function(t) {
|
||||
var client_id = String(new Date().getTime()) + String(Math.floor(Math.random() * 1e5));
|
||||
var url = "support/presentation.html#__castAppId__=C2335F62/__castClientId__="+ client_id;
|
||||
var request = new PresentationRequest(url);
|
||||
request.start()
|
||||
.then(function(connection) {
|
||||
assert_true(connection instanceof PresentationConnection);
|
||||
connection.onconnect = t.step_func_done(function() {
|
||||
assert_equals(connection.state, "connected");
|
||||
});
|
||||
connection.close();
|
||||
})
|
||||
.catch(function(ex) {
|
||||
assert_unreached(ex.name + ":" + ex.message);
|
||||
});
|
||||
}, "the onconnect is fired and the connection state is connected");
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>PresentationConnection.onterminate</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<link rel="author" title="Chunyan Wang" href="mailto:chunyanx.wang@intel.com">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#starting-a-presentation">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h2>Description</h2>
|
||||
<p>
|
||||
This test validates that after connection terminate,<br/>
|
||||
the connection state is set terminated,<br/>
|
||||
the onterminate EventHandler is triggered.
|
||||
</p>
|
||||
<br/>
|
||||
<p>Click the button below to start the test.</p>
|
||||
<button id="presentStartBtn" onclick="startPresentation()">Start Presentation Test</button>
|
||||
|
||||
<script>
|
||||
setup({explicit_timeout: true});
|
||||
var startPresentation = function () {
|
||||
async_test(function(t) {
|
||||
var client_id = String(new Date().getTime()) + String(Math.floor(Math.random() * 1e5));
|
||||
var url = "support/presentation.html#__castAppId__=C2335F62/__castClientId__="+ client_id;
|
||||
var request = new PresentationRequest(url);
|
||||
request.start()
|
||||
.then(function(connection) {
|
||||
assert_true(connection instanceof PresentationConnection);
|
||||
connection.onconnected = t.step_func(function(evt) {
|
||||
assert_equals(evt.state, "connected");
|
||||
connection.terminate();
|
||||
});
|
||||
connection.onterminate = t.step_func_done(function(evt) {
|
||||
assert_equals(evt.type, "terminate");
|
||||
assert_equals(connection.state, "terminated");
|
||||
});
|
||||
connection.onclose = t.step_func_done(function(evt) {
|
||||
assert_unreached("Wrong, the onclose shouldn't be triggered!");
|
||||
});
|
||||
})
|
||||
.catch(function(ex) {
|
||||
assert_unreached(ex.name + ":" + ex.message);
|
||||
});
|
||||
}, "the onterminate is fired and the connection state is terminated");
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API PresentationRequest for Controlling User Agent (Error)</title>
|
||||
<link rel="author" title="Franck William Taffo" 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>
|
||||
<script>
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new PresentationRequest();
|
||||
});
|
||||
}, 'Call PresentationRequest() constructor without presentation URL. TypeError Exception expected.');
|
||||
|
||||
test(function() {
|
||||
assert_throws('NotSupportedError', function() {
|
||||
new PresentationRequest([]);
|
||||
});
|
||||
}, 'Call PresentationRequest constructor with an empty sequence. NotSupportedError Exception expected.');
|
||||
|
||||
test(function() {
|
||||
assert_throws('SyntaxError', function() {
|
||||
new PresentationRequest('http://@');
|
||||
});
|
||||
}, 'Call PresentationRequest constructor with an invalid URL. SyntaxError Exception expected.');
|
||||
|
||||
test(function() {
|
||||
assert_throws('SyntaxError', function() {
|
||||
new PresentationRequest(['presentation.html', 'http://@']);
|
||||
});
|
||||
}, 'Call PresentationRequest constructor with a sequence of URLs, one of them invalid. SyntaxError Exception expected.');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API PresentationRequest for Controlling User Agent (Success)</title>
|
||||
<link rel="author" title="Franck William Taffo" 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>
|
||||
|
||||
<script>
|
||||
test(function() {
|
||||
try {
|
||||
var request = new PresentationRequest('presentation.html');
|
||||
assert_true(request instanceof PresentationRequest);
|
||||
}
|
||||
catch (ex) {
|
||||
assert_unreached('PresentationRequest constructor threw an unexpected exception "' + ex.name + '"');
|
||||
}
|
||||
}, 'Call PresentationRequest constructor with a valid relative presentation URL. No Exception expected.');
|
||||
|
||||
test(function() {
|
||||
try {
|
||||
var request = new PresentationRequest('http://example.org/');
|
||||
assert_true(request instanceof PresentationRequest);
|
||||
}
|
||||
catch (ex) {
|
||||
assert_unreached('PresentationRequest constructor threw an unexpected exception "' + ex.name + '"');
|
||||
}
|
||||
}, 'Call PresentationRequest constructor with a valid absolute presentation URL. No Exception expected.');
|
||||
|
||||
test(function() {
|
||||
try {
|
||||
var request = new PresentationRequest([
|
||||
'presentation.html',
|
||||
'http://example.org/presentation/'
|
||||
]);
|
||||
assert_true(request instanceof PresentationRequest);
|
||||
}
|
||||
catch (ex) {
|
||||
assert_unreached('PresentationRequest constructor threw an unexpected exception "' + ex.name + '"');
|
||||
}
|
||||
}, 'Call PresentationRequest constructor with a set of valid presentation URLs. No Exception expected.');
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API, testing to start a new presentation with an default request setup. (success - manual)</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 onclick="startPresentation()">Start Presentation Test</button>
|
||||
|
||||
<script>
|
||||
// disable the timeout function for the tests
|
||||
// and call 'done()' when the tests cases are finished.
|
||||
setup({explicit_timeout: true});
|
||||
|
||||
// -------------------
|
||||
// defaultRequest init
|
||||
// -------------------
|
||||
var validUnixDate = new Date().getTime() + String(Math.floor(Math.random() * 1e5)),
|
||||
validPresURL = '../receiving-ua/idlharness.html#__castAppId__=2334D33A/__castClientId__=' + validUnixDate;
|
||||
|
||||
navigator.presentation.defaultRequest = new PresentationRequest(validPresURL);
|
||||
|
||||
var startPresentation = function () {
|
||||
promise_test(function () {
|
||||
return navigator.presentation.defaultRequest.start();
|
||||
}, "The presentation was started successfully.");
|
||||
}
|
||||
// ------------------------------
|
||||
// Start New Presentation with
|
||||
// 'default request' Test - BEGIN
|
||||
// ------------------------------
|
||||
navigator.presentation.defaultRequest.onconnectionavailable = function (evt) {
|
||||
var connection = evt.connection;
|
||||
|
||||
test(function () {
|
||||
|
||||
assert_equals(connection.state, "connected", "The presentation has an connected state.");
|
||||
assert_true(!!connection.id, "The connection ID is set.");
|
||||
assert_true(typeof connection.id === 'string', "The connection ID is a string.");
|
||||
assert_true(connection instanceof PresentationConnection, "The connection is an instance of PresentationConnection.");
|
||||
|
||||
}, "The presentation was started successfully.");
|
||||
|
||||
done();
|
||||
};
|
||||
// ----------------------------
|
||||
// Start New Presentation with
|
||||
// 'default request' Test - END
|
||||
// ----------------------------
|
||||
</script>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API - monitor screen availability tests for Controlling User Agent</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>
|
||||
|
||||
<script>
|
||||
// ---------------------------------
|
||||
// Helper Function
|
||||
// ---------------------------------
|
||||
var createRequestObject = function () {
|
||||
var validUnixDate = new Date().getTime() + String(Math.floor(Math.random() * 1e5)),
|
||||
presUrl = "../receiving-ua/idlharness.html#__castAppId__=2334D33A/__castClientId__=" + validUnixDate,
|
||||
request = new PresentationRequest(presUrl);
|
||||
return request;
|
||||
}
|
||||
|
||||
// ---------------------------------
|
||||
// Screen Availability Tests - begin
|
||||
// ---------------------------------
|
||||
|
||||
// Instance of Promise Test
|
||||
test(function () {
|
||||
var request = createRequestObject();
|
||||
assert_true(request.getAvailability() instanceof Promise);
|
||||
}, 'The request is an Promise.')
|
||||
|
||||
// Instance of PresentationRequest Test
|
||||
test(function () {
|
||||
var request = createRequestObject();
|
||||
assert_true(request instanceof PresentationRequest);
|
||||
}, 'The request is an instance of PresentationRequest.')
|
||||
|
||||
// Instance of PresentationAvailability Test
|
||||
promise_test(function () {
|
||||
var request = createRequestObject();
|
||||
|
||||
return request.getAvailability()
|
||||
.then(function (availability) {
|
||||
assert_true(availability instanceof PresentationAvailability);
|
||||
});
|
||||
}, "The promise is an instance of PresentationAvailability");
|
||||
|
||||
// Availability.value is set Test
|
||||
promise_test(function () {
|
||||
var request = createRequestObject();
|
||||
|
||||
return request.getAvailability()
|
||||
.then(function (availability) {
|
||||
assert_true(typeof availability.value == 'boolean');
|
||||
});
|
||||
}, "The availability has an boolean value.");
|
||||
|
||||
|
||||
// Best Case Scenario Test
|
||||
// -----------------------
|
||||
promise_test(function () {
|
||||
var request = createRequestObject();
|
||||
|
||||
return request.getAvailability()
|
||||
.then(function (availability) {
|
||||
assert_true(availability.value);
|
||||
});
|
||||
}, "There is an availability.");
|
||||
|
||||
|
||||
// Invalid Presentation URL Test
|
||||
promise_test(function () {
|
||||
var validUnixDate = new Date().getTime() + String(Math.floor(Math.random() * 1e5)),
|
||||
invalidPresUrl = "../receiving-ua/idlharness.html#__castAppId__=3445E44B/__castClientId__=" + validUnixDate,
|
||||
request = new PresentationRequest(invalidPresUrl);
|
||||
|
||||
return request.getAvailability()
|
||||
.then(function (availability) {
|
||||
assert_false(availability.value);
|
||||
});
|
||||
}, "There is no availability for an invalid presentation URL.");
|
||||
// -------------------------------
|
||||
// Screen Availability Tests - end
|
||||
// -------------------------------
|
||||
</script>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Calling "getAvailability" with an a priori unauthenticated URL in an HTTPS context throws a SecurityError exception.</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-getavailability">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function getAvailability() {
|
||||
var request = new PresentationRequest('http://example.org/presentation.html');
|
||||
return request.getAvailability();
|
||||
}
|
||||
|
||||
promise_test(function (t) {
|
||||
return promise_rejects(t, 'SecurityError', getAvailability());
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Sandboxing: Retrieving display availability from a nested context fails when allow-presentation is not set</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-getavailability">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
function startWhenReady(ev) {
|
||||
var childFrame = document.getElementById('childFrame');
|
||||
if (ev.data === 'ready') {
|
||||
window.removeEventListener('message', startWhenReady);
|
||||
childFrame.contentWindow.postMessage('getAvailability', '*');
|
||||
window.addEventListener('message', t.step_func(function (ev) {
|
||||
assert_equals(ev.data, 'SecurityError',
|
||||
'Presentation sandboxing did not work as expected.');
|
||||
t.done();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('message', startWhenReady);
|
||||
});
|
||||
</script>
|
||||
<iframe id="childFrame" sandbox="allow-scripts" style="display:none" src="support/iframe.html"></iframe>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Sandboxing: Retrieving display availability from a nested context succeeds when allow-presentation is set</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-getavailability">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
function startWhenReady(ev) {
|
||||
var childFrame = document.getElementById('childFrame');
|
||||
if (ev.data === 'ready') {
|
||||
window.removeEventListener('message', startWhenReady);
|
||||
childFrame.contentWindow.postMessage('getAvailability', '*');
|
||||
window.addEventListener('message', t.step_func(function (ev) {
|
||||
assert_equals(ev.data, 'success',
|
||||
'Presentation sandboxing did not work as expected.');
|
||||
t.done();
|
||||
}));
|
||||
}
|
||||
}
|
||||
window.addEventListener('message', startWhenReady);
|
||||
});
|
||||
</script>
|
||||
<iframe id="childFrame" sandbox="allow-scripts allow-presentation" style="display:none" src="support/iframe.html"></iframe>
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API IDL tests for Controlling User Agent</title>
|
||||
<link rel="author" title="Louay Bassbouss" 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>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
|
||||
<script id="untested_idl" type="text/plain">
|
||||
interface Navigator {
|
||||
};
|
||||
interface EventTarget {
|
||||
};
|
||||
interface EventHandler {
|
||||
};
|
||||
interface Event {
|
||||
};
|
||||
dictionary EventInit {
|
||||
};
|
||||
</script>
|
||||
|
||||
<script id='idl' type="text/plain">
|
||||
partial interface Navigator {
|
||||
[SameObject]
|
||||
readonly attribute Presentation? presentation;
|
||||
};
|
||||
|
||||
interface Presentation {
|
||||
};
|
||||
|
||||
partial interface Presentation {
|
||||
attribute PresentationRequest? defaultRequest;
|
||||
};
|
||||
|
||||
[Constructor(DOMString url),
|
||||
Constructor(sequence<DOMString> urls)]
|
||||
interface PresentationRequest : EventTarget {
|
||||
Promise<PresentationConnection> start();
|
||||
Promise<PresentationConnection> reconnect(DOMString presentationId);
|
||||
Promise<PresentationAvailability> getAvailability();
|
||||
|
||||
attribute EventHandler onconnectionavailable;
|
||||
};
|
||||
|
||||
interface PresentationAvailability : EventTarget {
|
||||
readonly attribute boolean value;
|
||||
attribute EventHandler onchange;
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, PresentationConnectionAvailableEventInit eventInitDict)]
|
||||
interface PresentationConnectionAvailableEvent : Event {
|
||||
[SameObject]
|
||||
readonly attribute PresentationConnection connection;
|
||||
};
|
||||
|
||||
dictionary PresentationConnectionAvailableEventInit : EventInit {
|
||||
required PresentationConnection connection;
|
||||
};
|
||||
|
||||
enum PresentationConnectionState {
|
||||
"connecting",
|
||||
"connected",
|
||||
"closed",
|
||||
"terminated"
|
||||
};
|
||||
|
||||
enum BinaryType {
|
||||
"blob",
|
||||
"arraybuffer"
|
||||
};
|
||||
|
||||
interface PresentationConnection : EventTarget {
|
||||
readonly attribute DOMString id;
|
||||
readonly attribute DOMString url;
|
||||
readonly attribute PresentationConnectionState state;
|
||||
void close();
|
||||
void terminate();
|
||||
attribute EventHandler onconnect;
|
||||
attribute EventHandler onclose;
|
||||
attribute EventHandler onterminate;
|
||||
|
||||
// Communication
|
||||
attribute BinaryType binaryType;
|
||||
attribute EventHandler onmessage;
|
||||
void send(DOMString message);
|
||||
void send(Blob data);
|
||||
void send(ArrayBuffer data);
|
||||
void send(ArrayBufferView data);
|
||||
};
|
||||
|
||||
enum PresentationConnectionClosedReason {
|
||||
"error",
|
||||
"closed",
|
||||
"wentaway"
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, PresentationConnectionCloseEventInit eventInitDict)]
|
||||
interface PresentationConnectionCloseEvent : Event {
|
||||
readonly attribute PresentationConnectionClosedReason reason;
|
||||
readonly attribute DOMString message;
|
||||
};
|
||||
|
||||
dictionary PresentationConnectionCloseEventInit : EventInit {
|
||||
required PresentationConnectionClosedReason reason;
|
||||
DOMString message = "";
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
"use strict";
|
||||
var idl_array = new IdlArray();
|
||||
var idls = document.getElementById('idl').textContent;
|
||||
idl_array.add_untested_idls(document.getElementById('untested_idl').textContent);
|
||||
idl_array.add_idls(idls);
|
||||
window.presentation_request = new PresentationRequest("/presentation-api/receiving-ua/idlharness.html");
|
||||
window.presentation_request_urls = new PresentationRequest(["/presentation-api/receiving-ua/idlharness.html",
|
||||
"http://www.example.com/presentation.html"]);
|
||||
navigator.presentation.defaultRequest = presentation_request;
|
||||
idl_array.add_objects({
|
||||
Presentation: ['navigator.presentation'],
|
||||
PresentationRequest: ['navigator.presentation.defaultRequest', 'presentation_request', 'presentation_request_urls']
|
||||
});
|
||||
idl_array.test();
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API reconnect a presentation for Controlling User Agent (Error - manual test)</title>
|
||||
<link rel="author" title="Franck William Taffo" 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>
|
||||
<script>
|
||||
|
||||
/**
|
||||
*
|
||||
* Test if reconnect returns a NotFoundError() by wrong presentation ID
|
||||
*/
|
||||
|
||||
var client_id = String(new Date().getTime()) + String(Math.floor(Math.random() * 1e5));
|
||||
//relative presentation URL
|
||||
var presentation_url = "../receiving-ua/idlharness.html#__castAppId__=2334D33A/__castClientId__="+ client_id;
|
||||
var request = new PresentationRequest(presentation_url);
|
||||
var wrong_presentationId = null;
|
||||
|
||||
var reconnect = function () {
|
||||
promise_test(function () {
|
||||
|
||||
var presId = "presId";
|
||||
// presId is mandatory when reconnecting to a presentation.
|
||||
return request.reconnect(presId)
|
||||
.then(function (setConnection) {
|
||||
assert_unreached("reconnect should not return a Promise resolve by wrong presentation ID");
|
||||
})
|
||||
}, "Check that the promise is rejected by wrong presentation Id");
|
||||
};
|
||||
|
||||
setup({explicit_timeout: true})
|
||||
</script>
|
||||
<p>click on the button to the perfom the test</p>
|
||||
<button id="reconnectBtn" onclick="reconnect()">Reconnect</button>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Calling "reconnect" with an a priori unauthenticated URL in an HTTPS context throws a SecurityError exception.</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-reconnect">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function reconnectToPresentation() {
|
||||
var request = new PresentationRequest('http://example.org/presentation.html');
|
||||
return request.reconnect('someid');
|
||||
}
|
||||
|
||||
promise_test(function (t) {
|
||||
return promise_rejects(t, 'SecurityError', reconnectToPresentation());
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Sandboxing: Reconnecting a presentation from a nested context fails when allow-presentation is not set</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-reconnect">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
function startWhenReady(ev) {
|
||||
var childFrame = document.getElementById('childFrame');
|
||||
if (ev.data === 'ready') {
|
||||
window.removeEventListener('message', startWhenReady);
|
||||
childFrame.contentWindow.postMessage('reconnect', '*');
|
||||
window.addEventListener('message', t.step_func(function (ev) {
|
||||
assert_equals(ev.data, 'SecurityError',
|
||||
'Presentation sandboxing did not work as expected.');
|
||||
t.done();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('message', startWhenReady);
|
||||
});
|
||||
</script>
|
||||
<iframe id="childFrame" sandbox="allow-scripts" style="display:none" src="support/iframe.html"></iframe>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Sandboxing: Reconnecting a presentation from a nested context succeeds when allow-presentation is set</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-reconnect">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
function startWhenReady(ev) {
|
||||
var childFrame = document.getElementById('childFrame');
|
||||
if (ev.data === 'ready') {
|
||||
window.removeEventListener('message', startWhenReady);
|
||||
childFrame.contentWindow.postMessage('reconnect', '*');
|
||||
window.addEventListener('message', t.step_func(function (ev) {
|
||||
assert_equals(ev.data, 'NotFoundError',
|
||||
'Presentation sandboxing did not work as expected.');
|
||||
t.done();
|
||||
}));
|
||||
}
|
||||
}
|
||||
window.addEventListener('message', startWhenReady);
|
||||
});
|
||||
</script>
|
||||
<iframe id="childFrame" sandbox="allow-scripts allow-presentation" style="display:none" src="support/iframe.html"></iframe>
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API, reconnect to 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>
|
||||
|
||||
<ol>
|
||||
<li>Start the presentation with the blue button.</li>
|
||||
<li>After the presentation ist running successfully, disconnect the connected device.</li>
|
||||
<li>Reconnect the device and press the green button, to start the reconnection process.</li>
|
||||
</ol>
|
||||
|
||||
<button id="startBtn" onclick="startPresentation()" style="background-color: #2aabd2;">Start Presentation</button>
|
||||
<button id="reconnectBtn" onclick="reconnectToPresentation()" style="background-color: #5cb85c;">Reconnect Presentation
|
||||
Test
|
||||
</button>
|
||||
|
||||
<script>
|
||||
// disable the timeout function for the tests
|
||||
// and call 'done()' when the tests cases are finished.
|
||||
setup({explicit_timeout: true});
|
||||
|
||||
// ----------
|
||||
// DOM Object
|
||||
// ----------
|
||||
var startBtn = document.getElementById("startBtn"),
|
||||
reconnectBtn = document.getElementById("reconnectBtn");
|
||||
|
||||
// ------------
|
||||
// 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);
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
// Helper Function - start the presentation
|
||||
// ----------------------------------------
|
||||
var startPresentation = function () {
|
||||
return request.start()
|
||||
.then(function (connection) {
|
||||
// save the presentation id within the
|
||||
// local storage of the browser
|
||||
localStorage["presId"] = connection.id;
|
||||
});
|
||||
}
|
||||
|
||||
// ------------------------------------------------
|
||||
// Reconnect to Presentation Test (success) - begin
|
||||
// ------------------------------------------------
|
||||
var reconnectToPresentation = function () {
|
||||
|
||||
promise_test(function () {
|
||||
|
||||
// get the saved presentation id
|
||||
// for the reconnect function if exist
|
||||
if (localStorage["presId"]) var presId = localStorage["presId"];
|
||||
|
||||
return request.reconnect(presId)
|
||||
.then(function (connection) {
|
||||
assert_true(connection instanceof PresentationConnection);
|
||||
done();
|
||||
});
|
||||
}, 'The reconnection was successful.');
|
||||
}
|
||||
// ----------------------------------------------
|
||||
// Reconnect to Presentation Test (success) - end
|
||||
// ----------------------------------------------
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API, start new presentation tests for Controlling User Agent (error)</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>
|
||||
<script>
|
||||
|
||||
|
||||
// ------------
|
||||
// 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 - begin
|
||||
// -----------------------------------
|
||||
promise_test(function (t) {
|
||||
promise_rejects(t, 'InvalidAccessError', request.start());
|
||||
}, "The presentation could not start, because a user gesture is required.");
|
||||
// ----------------------------------
|
||||
// Launch New Presentation Test - end
|
||||
// ----------------------------------
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Calling "start" with an a priori unauthenticated URL in an HTTPS context throws a SecurityError exception.</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-start">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<p>Click the button below to start the manual test. If prompted to select a device, please dismiss the dialog box. The test passes if a "PASS" result appears.</p>
|
||||
<button id="presentBtn" onclick="startPresentationTest()">Start Presentation Test</button>
|
||||
|
||||
<script>
|
||||
setup({explicit_timeout: true});
|
||||
|
||||
var presentBtn = document.getElementById("presentBtn");
|
||||
|
||||
function startPresentation() {
|
||||
var request = new PresentationRequest('http://example.org/presentation.html');
|
||||
return request.start();
|
||||
};
|
||||
|
||||
function startPresentationTest() {
|
||||
presentBtn.disabled = true;
|
||||
promise_test(function (t) {
|
||||
return promise_rejects(t, 'SecurityError', startPresentation());
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Calling "start" with a set of URLs containing an a priori unauthenticated URL in an HTTPS context throws a SecurityError exception.</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-start">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<p>Click the button below to start the manual test. If prompted to select a device, please dismiss the dialog box. The test passes if a "PASS" result appears.</p>
|
||||
<button id="presentBtn" onclick="startPresentationTest()">Start Presentation Test</button>
|
||||
|
||||
<script>
|
||||
setup({explicit_timeout: true});
|
||||
|
||||
var presentBtn = document.getElementById("presentBtn");
|
||||
|
||||
function startPresentation() {
|
||||
var request = new PresentationRequest([
|
||||
'presentation.html',
|
||||
'http://example.org/presentation.html'
|
||||
]);
|
||||
return request.start();
|
||||
};
|
||||
|
||||
function startPresentationTest() {
|
||||
presentBtn.disabled = true;
|
||||
promise_test(function (t) {
|
||||
return promise_rejects(t, 'SecurityError', startPresentation());
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Sandboxing: starting a presentation from a nested context fails when allow-presentation is not set</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-start">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<iframe id="childFrame" sandbox="allow-scripts" style="display:none" src="support/iframe.html"></iframe>
|
||||
<p>Click the button below to start the manual test. If prompted to select a device, please dismiss the dialog box. The test passes if a "PASS" result appears.</p>
|
||||
<button id="presentBtn" onclick="startPresentationTest()">Start Presentation Test</button>
|
||||
|
||||
<script>
|
||||
setup({explicit_timeout: true});
|
||||
|
||||
var presentBtn = document.getElementById('presentBtn');
|
||||
var childFrame = document.getElementById('childFrame');
|
||||
|
||||
function startPresentationTest() {
|
||||
presentBtn.disabled = true;
|
||||
async_test(function (t) {
|
||||
childFrame.contentWindow.postMessage('start', '*');
|
||||
window.addEventListener('message', t.step_func(function (ev) {
|
||||
assert_equals(ev.data, 'SecurityError',
|
||||
'Presentation sandboxing did not work as expected.');
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Sandboxing: starting a presentation from a nested context succeeds when allow-presentation is set</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-start">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<iframe id="childFrame" sandbox="allow-scripts allow-presentation" style="display:none" src="support/iframe.html"></iframe>
|
||||
<p>Click the button below to start the manual test. If prompted to select a device, please dismiss the dialog box. The test passes if a "PASS" result appears.</p>
|
||||
<button id="presentBtn" onclick="startPresentationTest()">Start Presentation Test</button>
|
||||
|
||||
<script>
|
||||
setup({explicit_timeout: true});
|
||||
|
||||
var presentBtn = document.getElementById('presentBtn');
|
||||
var childFrame = document.getElementById('childFrame');
|
||||
|
||||
function startPresentationTest() {
|
||||
presentBtn.disabled = true;
|
||||
async_test(function (t) {
|
||||
childFrame.contentWindow.postMessage('start', '*');
|
||||
window.addEventListener('message', t.step_func(function (ev) {
|
||||
assert_equals(ev.data, 'success',
|
||||
'Presentation could not be started from nested frame.');
|
||||
t.done();
|
||||
}));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,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>
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API - controlling ua - sandboxing</title>
|
||||
<link rel="author" title="Francois Daoust" href="https://www.w3.org/People/#fd">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-start">
|
||||
<script>
|
||||
window.onmessage = function (ev) {
|
||||
try {
|
||||
var request = new PresentationRequest('presentation.html');;
|
||||
if (ev.data === 'start') {
|
||||
request.start()
|
||||
.then(function () {
|
||||
parent.window.postMessage('success', '*');
|
||||
})
|
||||
.catch(function (err) {
|
||||
if ((err.name === 'NotFoundError') ||
|
||||
(err.name === 'NotAllowedError')) {
|
||||
// These errors either mean that the user dismissed the dialog
|
||||
// box or that the UA could not find any available or suitable
|
||||
// screen. This is equivalent of succeeding for the purpose of
|
||||
// iframe tests.
|
||||
parent.window.postMessage('success', '*');
|
||||
}
|
||||
else {
|
||||
parent.window.postMessage(err.name, '*');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (ev.data === 'reconnect') {
|
||||
request.reconnect('someid')
|
||||
.then(function () {
|
||||
parent.window.postMessage('success', '*');
|
||||
})
|
||||
.catch(function (err) {
|
||||
parent.window.postMessage(err.name, '*');
|
||||
});
|
||||
}
|
||||
else if (ev.data === 'getAvailability') {
|
||||
request.getAvailability()
|
||||
.then(function () {
|
||||
parent.window.postMessage('success', '*');
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (err.name === 'NotSupportedError') {
|
||||
parent.window.postMessage('success', '*');
|
||||
}
|
||||
else {
|
||||
parent.window.postMessage(err.name, '*');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
parent.window.postMessage('Could not create PresentationRequest', '*');
|
||||
}
|
||||
}
|
||||
parent.window.postMessage('ready', '*');
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<link rel="author" title="He Yue" href="mailto:yue.he@intel.com">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#interface-presentationconnectionlist">
|
||||
<script>
|
||||
var addConnection = function(connection) {
|
||||
connection.onconnected = function () {
|
||||
this.onmessage = function (evt) {
|
||||
this.send(evt.data);
|
||||
};
|
||||
};
|
||||
navigator.receiver.connectionList
|
||||
.then(function(list) {
|
||||
list.onconnectionavailable = function(connections) {
|
||||
addConnection(connections[connections.length - 1]);
|
||||
};
|
||||
list.connections.map(function(connection) {
|
||||
addConnection(connection);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Presentation API IDL tests for Receiving User Agent</title>
|
||||
<link rel="author" title="Louay Bassbouss" href="http://www.fokus.fraunhofer.de">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dfn-receiving-user-agent">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
|
||||
<script id="untested_idl" type="text/plain">
|
||||
interface Navigator {
|
||||
};
|
||||
interface EventTarget {
|
||||
};
|
||||
interface EventHandler {
|
||||
};
|
||||
interface Event {
|
||||
};
|
||||
dictionary EventInit {
|
||||
};
|
||||
</script>
|
||||
|
||||
<script id='idl' type="text/plain">
|
||||
partial interface Navigator {
|
||||
[SameObject]
|
||||
readonly attribute Presentation? presentation;
|
||||
};
|
||||
|
||||
interface Presentation {
|
||||
};
|
||||
|
||||
partial interface Presentation {
|
||||
[SameObject]
|
||||
readonly attribute PresentationReceiver? receiver;
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, PresentationConnectionAvailableEventInit eventInitDict)]
|
||||
interface PresentationConnectionAvailableEvent : Event {
|
||||
[SameObject]
|
||||
readonly attribute PresentationConnection connection;
|
||||
};
|
||||
|
||||
dictionary PresentationConnectionAvailableEventInit : EventInit {
|
||||
required PresentationConnection connection;
|
||||
};
|
||||
|
||||
enum PresentationConnectionState {
|
||||
"connecting",
|
||||
"connected",
|
||||
"closed",
|
||||
"terminated"
|
||||
};
|
||||
|
||||
enum BinaryType {
|
||||
"blob",
|
||||
"arraybuffer"
|
||||
};
|
||||
|
||||
interface PresentationConnection : EventTarget {
|
||||
readonly attribute DOMString? id;
|
||||
readonly attribute PresentationConnectionState state;
|
||||
void close();
|
||||
void terminate();
|
||||
attribute EventHandler onconnect;
|
||||
attribute EventHandler onclose;
|
||||
attribute EventHandler onterminate;
|
||||
|
||||
// Communication
|
||||
attribute BinaryType binaryType;
|
||||
attribute EventHandler onmessage;
|
||||
void send(DOMString message);
|
||||
void send(Blob data);
|
||||
void send(ArrayBuffer data);
|
||||
void send(ArrayBufferView data);
|
||||
};
|
||||
|
||||
enum PresentationConnectionClosedReason {
|
||||
"error",
|
||||
"closed",
|
||||
"wentaway"
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, PresentationConnectionCloseEventInit eventInitDict)]
|
||||
interface PresentationConnectionCloseEvent : Event {
|
||||
readonly attribute PresentationConnectionClosedReason reason;
|
||||
readonly attribute DOMString message;
|
||||
};
|
||||
|
||||
dictionary PresentationConnectionCloseEventInit : EventInit {
|
||||
required PresentationConnectionClosedReason reason;
|
||||
DOMString message = "";
|
||||
};
|
||||
|
||||
interface PresentationReceiver {
|
||||
[SameObject]
|
||||
readonly attribute Promise<PresentationConnectionList> connectionList;
|
||||
};
|
||||
|
||||
interface PresentationConnectionList : EventTarget {
|
||||
readonly attribute FrozenArray<PresentationConnection> connections;
|
||||
attribute EventHandler onconnectionavailable;
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
"use strict";
|
||||
var idl_array = new IdlArray();
|
||||
var idls = document.getElementById('idl').textContent;
|
||||
idl_array.add_untested_idls(document.getElementById('untested_idl').textContent);
|
||||
idl_array.add_idls(idls);
|
||||
idl_array.add_objects({
|
||||
Presentation: ['navigator.presentation'],
|
||||
PresentationReceiver: ['navigator.presentation.receiver']
|
||||
});
|
||||
idl_array.test();
|
||||
})();
|
||||
</script>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue