blob: 1f70c78bf365ac00b89993e16f9fb2a7f20642b1 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/mojo-helpers.js"></script>
<script src="resources/presentation-service-mock.js"></script>
<button>click me</button>
<script>
var button = document.querySelector('button');
async_test(t => {
presentationServiceMock.then(service => {
service.startPresentation = urls => {
return Promise.resolve({
presentation_info: null,
error: {
error_type: 3 /* PresentationErrorType.PREVIOUS_START_IN_PROGRESS */,
message: 'Previous start in progress'
}
});
};
// This is receiving the user gesture and runs the callback.
waitForClick(() => {
var request = new PresentationRequest("http://example.com");
request.start().catch(t.step_func_done(ex => {
assert_equals(ex.name, 'OperationError');
}));
}, button);
});
}, "Test that the PresentationRequest.start() rejects with OperationError if PresentationService reports PREVIOUS_START_IN_PROGRESS error");
</script>
</body>
</html>