OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
6 <script src="../resources/mojo-helpers.js"></script> | 6 <script src="../resources/mojo-helpers.js"></script> |
7 <script src="resources/presentation-service-mock.js"></script> | 7 <script src="resources/presentation-service-mock.js"></script> |
8 <button>click me</button> | 8 <button>click me</button> |
9 <script> | 9 <script> |
10 | 10 |
11 var button = document.querySelector('button'); | 11 var button = document.querySelector('button'); |
12 | 12 |
13 async_test(t => { | 13 async_test(t => { |
14 presentationServiceMock.then(service => { | 14 presentationServiceMock.then(service => { |
15 service.startSession = urls => { | 15 service.startPresentation = urls => { |
16 return Promise.resolve({ | 16 return Promise.resolve({ |
17 sessionInfo: null, | 17 presentation_info: null, |
18 error: { | 18 error: { |
19 error_type: 3 /* PresentationErrorType.PREVIOUS_START_IN_PROGRESS */, | 19 error_type: 3 /* PresentationErrorType.PREVIOUS_START_IN_PROGRESS */, |
20 message: 'Previous start in progress' | 20 message: 'Previous start in progress' |
21 } | 21 } |
22 }); | 22 }); |
23 }; | 23 }; |
24 // This is receiving the user gesture and runs the callback. | 24 // This is receiving the user gesture and runs the callback. |
25 waitForClick(() => { | 25 waitForClick(() => { |
26 var request = new PresentationRequest("http://example.com"); | 26 var request = new PresentationRequest("http://example.com"); |
27 request.start().catch(t.step_func_done(ex => { | 27 request.start().catch(t.step_func_done(ex => { |
28 assert_equals(ex.name, 'OperationError'); | 28 assert_equals(ex.name, 'OperationError'); |
29 })); | 29 })); |
30 }, button); | 30 }, button); |
31 }); | 31 }); |
32 }, "Test that the PresentationRequest.start() rejects with OperationError if Pre
sentationService reports PREVIOUS_START_IN_PROGRESS error"); | 32 }, "Test that the PresentationRequest.start() rejects with OperationError if Pre
sentationService reports PREVIOUS_START_IN_PROGRESS error"); |
33 | 33 |
34 </script> | 34 </script> |
35 </body> | 35 </body> |
36 </html> | 36 </html> |
OLD | NEW |