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

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

Issue 2552343009: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed)
Patch Set: resolve code review comments from mlamouri Created 4 years 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";
whywhat 2016/12/14 02:20:39 I think in general your presentation-api.html addi
10 var request = new PresentationRequest("http://example.com"); 10 var presentationUrls = [presentationUrl, "cast://google.com/app_id=deadbeef"];
11
12 var testUserGesture = function(t, requestArgument) {
mlamouri (slow - plz ping) 2016/12/13 13:50:53 Having the method called `testUserGesture` is conf
zhaobin 2016/12/14 01:51:53 Term "user gesture" may come from "The controlling
whywhat 2016/12/14 02:20:39 I think Mounir means that the name could be more s
zhaobin 2016/12/14 03:00:27 I misunderstood "token"...sorry for that.
whywhat 2016/12/14 03:53:14 No worries, IIUC it's a Blink specific terminology
13 var request = new PresentationRequest(requestArgument);
11 request.start().catch(t.step_func(function(e) { 14 request.start().catch(t.step_func(function(e) {
whywhat 2016/12/14 02:20:39 nit: you can use t.step_func_done and remove t.don
zhaobin 2016/12/14 03:00:27 Done.
12 assert_true(e instanceof DOMException); 15 assert_true(e instanceof DOMException);
13 assert_equals(e.name, "InvalidAccessError"); 16 assert_equals(e.name, "InvalidAccessError");
14 assert_equals(e.message, "PresentationRequest::start() requires user gesture ."); 17 assert_equals(e.message, "PresentationRequest::start() requires user gesture .");
15 t.done(); 18 t.done();
16 })); 19 }));
whywhat 2016/12/14 02:20:39 you should probably also have then(t.unreached_fun
zhaobin 2016/12/14 03:00:26 Done.
17 }, "Test that the PresentationRequest.start() requires user gesture.") 20 };
18 21
19 test(function() { 22 async_test(function(t) {
whywhat 2016/12/14 02:20:39 ...or you could even use promise_test (https://git
zhaobin 2016/12/14 03:00:27 Done.
20 navigator.presentation.defaultRequest = new PresentationRequest("http://exampl e.com"); 23 testUserGesture(t, presentationUrl);
24 }, "Test that the PresentationRequest.start() with one URL requires user gesture .")
25
26 async_test(function(t) {
27 testUserGesture(t, presentationUrls);
28 }, "Test that the PresentationRequest.start() with multiple URLs requires user g esture.")
29
30 var testGarbageCollection = function(requestArgument) {
31 navigator.presentation.defaultRequest = new PresentationRequest(requestArgumen t);
21 navigator.presentation.defaultRequest.onconnectionavailable = function() { }; 32 navigator.presentation.defaultRequest.onconnectionavailable = function() { };
22 gc(); 33 gc();
23 assert_not_equals(navigator.presentation.defaultRequest.onconnectionavailable, undefined); 34 assert_not_equals(navigator.presentation.defaultRequest.onconnectionavailable, undefined);
24 }, "Test that navigator.presentation.defaultRequest.onconnectionavailable isn't reset after gc()"); 35 };
36
37 test(function() {
38 testGarbageCollection(presentationUrl);
39 }, "Test that navigator.presentation.defaultRequest.onconnectionavailable with o ne URL isn't reset after gc().");
40
41 test(function() {
42 testGarbageCollection(presentationUrls);
43 }, "Test that navigator.presentation.defaultRequest.onconnectionavailable with m ultiple URLs isn't reset after gc().");
25 44
26 </script> 45 </script>
27 </body> 46 </body>
28 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698