Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PresentationConnection.onclose pass #4222

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,24 @@ <h2>Description</h2>

<script>
setup({explicit_timeout: true});

var startPresentation = function () {
document.getElementById('presentBtn').disabled = true;
async_test(function(t) {

promise_test(function(t) {
var request = new PresentationRequest(presentationUrls);
request.start()
.then(function(connection) {

var check = 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);
});
};

return request.start().then(check);
}, "the onclose is fired and the connection state is closed.");
}
};

</script>
9 changes: 5 additions & 4 deletions presentation-api/controlling-ua/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
// on something that directly or indirectly maps to a resource on the W3C test
// server.
var castAppId = '915D2A2C';
var castUrl = 'https://google.com/cast#__castAppId__=' + castAppId;
var castClientId = String(new Date().getTime()) + String(Math.floor(Math.random() * 1e5));
var castUrl = 'https://google.com/cast#__castAppId__=' + castAppId + '/__castClientId__=' + castClientId;

window.presentationUrls = [
'support/presentation.html',
castUrl
castUrl,
'support/presentation.html'
];
})(window);
})(window);