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

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

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

Powered by Google App Engine
This is Rietveld 408576698