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

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

Issue 2552343009: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed)
Patch Set: rebase 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 async_test(function(t) { 9 var presentationUrl = "http://example.com";
10 var request = new PresentationRequest("http://example.com"); 10 var presentationUrls = [presentationUrl, "cast://google.com/app_id=deadbeef"];
11 request.start().catch(t.step_func(function(e) {
12 assert_true(e instanceof DOMException);
13 assert_equals(e.name, "InvalidAccessError");
14 assert_equals(e.message, "PresentationRequest::start() requires user gesture .");
15 t.done();
16 }));
17 }, "Test that the PresentationRequest.start() requires user gesture.")
18 11
19 test(function() { 12 var expectedException = new DOMException('PresentationRequest::start() requires user gesture.', 'InvalidAccessError');
20 navigator.presentation.defaultRequest = new PresentationRequest("http://exampl e.com"); 13
14 promise_test(function(t) {
15 var request = new PresentationRequest(presentationUrl);
16 return promise_rejects(t, expectedException, request.start());
17 }, "Test that the PresentationRequest.start() with one URL requires user gesture .")
18
19 promise_test(function(t) {
20 var request = new PresentationRequest(presentationUrls);
21 return promise_rejects(t, expectedException, request.start());
22 }, "Test that the PresentationRequest.start() with multiple URLs requires user g esture.")
23
24 var testGarbageCollection = function(requestArgument) {
25 navigator.presentation.defaultRequest = new PresentationRequest(requestArgumen t);
21 navigator.presentation.defaultRequest.onconnectionavailable = function() { }; 26 navigator.presentation.defaultRequest.onconnectionavailable = function() { };
22 gc(); 27 gc();
foolip 2017/01/11 16:26:10 What object should this GC? The newly created Pres
zhaobin 2017/01/12 00:19:31 It is an existing test. It seems to test that defa
foolip 2017/01/13 20:29:27 You are expanding on the tests here, but if I'm co
zhaobin 2017/01/14 00:46:06 Asking mlamouri@.
23 assert_not_equals(navigator.presentation.defaultRequest.onconnectionavailable, undefined); 28 assert_not_equals(navigator.presentation.defaultRequest.onconnectionavailable, undefined);
24 }, "Test that navigator.presentation.defaultRequest.onconnectionavailable isn't reset after gc()"); 29 };
30
31 test(function() {
32 testGarbageCollection(presentationUrl);
33 }, "Test that navigator.presentation.defaultRequest.onconnectionavailable with o ne URL isn't reset after gc().");
34
35 test(function() {
36 testGarbageCollection(presentationUrls);
37 }, "Test that navigator.presentation.defaultRequest.onconnectionavailable with m ultiple URLs isn't reset after gc().");
25 38
26 test(function() { 39 test(function() {
27 var request = new PresentationRequest("http://example.com"); 40 var request = new PresentationRequest("http://example.com");
28 var promise_1 = request.getAvailability(); 41 var promise_1 = request.getAvailability();
29 var promise_2 = request.getAvailability(); 42 var promise_2 = request.getAvailability();
30 assert_true(promise_1 === promise_2); 43 assert_true(promise_1 === promise_2);
31 }, "Test that the PresentationRequest.getAvailability() returns same promise obj ect."); 44 }, "Test that the PresentationRequest.getAvailability() returns same promise obj ect.");
32 45
33 </script> 46 </script>
34 </body> 47 </body>
35 </html> 48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698