Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: third_party/WebKit/LayoutTests/presentation/presentationrequest.html

Issue 2643473002: [Presentation API] Allow PresentationConnection state change to "Connecting" (Closed)
Patch Set: Address Mark and Bin's comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/gc.js"></script> 6 <script src="../resources/gc.js"></script>
7 <script> 7 <script>
8 8
9 var presentationUrl = "http://example.com"; 9 const presentationUrl = 'http://example.com';
10 var presentationUrls = [presentationUrl, "cast://google.com/app_id=deadbeef"]; 10 const presentationUrls = [presentationUrl, 'cast://google.com/app_id=deadbeef'];
11 11
12 var expectedException = new DOMException('PresentationRequest::start() requires user gesture.', 'InvalidAccessError'); 12 const expectedException = new DOMException(
13 'PresentationRequest::start() requires user gesture.',
14 'InvalidAccessError');
13 15
14 promise_test(function(t) { 16 promise_test(function(t) {
15 var request = new PresentationRequest(presentationUrl); 17 const request = new PresentationRequest(presentationUrl);
16 return promise_rejects(t, expectedException, request.start()); 18 return promise_rejects(t, expectedException, request.start());
17 }, "Test that the PresentationRequest.start() with one URL requires user gesture .") 19 }, 'Test that the PresentationRequest.start() with one URL requires user gesture .')
18 20
19 promise_test(function(t) { 21 promise_test(
20 var request = new PresentationRequest(presentationUrls); 22 function(t) {
21 return promise_rejects(t, expectedException, request.start()); 23 const request = new PresentationRequest(presentationUrls);
22 }, "Test that the PresentationRequest.start() with multiple URLs requires user g esture.") 24 return promise_rejects(t, expectedException, request.start());
25 },
26 'Test that the PresentationRequest.start() with multiple URLs requires user gesture.')
23 27
24 var testGarbageCollection = function(requestArgument) { 28 const testGarbageCollection = function(requestArgument) {
25 navigator.presentation.defaultRequest = new PresentationRequest(requestArgumen t); 29 navigator.presentation.defaultRequest =
26 navigator.presentation.defaultRequest.onconnectionavailable = function() { }; 30 new PresentationRequest(requestArgument);
27 gc(); 31 navigator.presentation.defaultRequest.onconnectionavailable = function() {
28 assert_not_equals(navigator.presentation.defaultRequest.onconnectionavailable, undefined); 32 };
29 }; 33 gc();
34 assert_not_equals(
35 navigator.presentation.defaultRequest.onconnectionavailable,
36 undefined);
37 };
30 38
31 test(function() { 39 test(function() {
32 testGarbageCollection(presentationUrl); 40 testGarbageCollection(presentationUrl);
33 }, "Test that navigator.presentation.defaultRequest.onconnectionavailable with o ne URL isn't reset after gc()."); 41 }, 'Test that navigator.presentation.defaultRequest.onconnectionavailable with o ne URL isn\'t reset after gc().');
34 42
35 test(function() { 43 test(function() {
36 testGarbageCollection(presentationUrls); 44 testGarbageCollection(presentationUrls);
37 }, "Test that navigator.presentation.defaultRequest.onconnectionavailable with m ultiple URLs isn't reset after gc()."); 45 }, 'Test that navigator.presentation.defaultRequest.onconnectionavailable with m ultiple URLs isn\'t reset after gc().');
38 46
39 test(function() { 47 test(function() {
40 var request = new PresentationRequest("http://example.com"); 48 const request = new PresentationRequest('http://example.com');
41 var promise_1 = request.getAvailability(); 49 const promise_1 = request.getAvailability();
42 var promise_2 = request.getAvailability(); 50 const promise_2 = request.getAvailability();
43 assert_true(promise_1 === promise_2); 51 assert_true(promise_1 === promise_2);
44 }, "Test that the PresentationRequest.getAvailability() returns same promise obj ect."); 52 }, 'Test that the PresentationRequest.getAvailability() returns same promise obj ect.');
45 53
46 </script> 54 </script>
47 </body> 55 </body>
48 </html> 56 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698