| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> |
| <script src="file:///gen/third_party/WebKit/public/platform/modules/presentation/presentation.mojom.js"></script> |
| <script src="resources/presentation-service-mock.js"></script> |
| <button>click me</button> |
| <script> |
| |
| var button = document.querySelector('button'); |
| |
| async_test(t => { |
| presentationServiceMock.startPresentation = urls => { |
| return Promise.resolve({ |
| presentation_info: null, |
| error: { |
| errorType: blink.mojom.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> |