Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/presentation/presentationrequest.html |
| diff --git a/third_party/WebKit/LayoutTests/presentation/presentationrequest.html b/third_party/WebKit/LayoutTests/presentation/presentationrequest.html |
| index d4b538c2fda08c92d618cc90abb9a24c805a1769..4d16ca70510ab25ff5818208e88f8a6b7246d2a5 100644 |
| --- a/third_party/WebKit/LayoutTests/presentation/presentationrequest.html |
| +++ b/third_party/WebKit/LayoutTests/presentation/presentationrequest.html |
| @@ -6,22 +6,41 @@ |
| <script src="../resources/gc.js"></script> |
| <script> |
| -async_test(function(t) { |
| - var request = new PresentationRequest("http://example.com"); |
| +var presentationUrl = "http://example.com"; |
|
whywhat
2016/12/14 02:20:39
I think in general your presentation-api.html addi
|
| +var presentationUrls = [presentationUrl, "cast://google.com/app_id=deadbeef"]; |
| + |
| +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
|
| + var request = new PresentationRequest(requestArgument); |
| 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.
|
| assert_true(e instanceof DOMException); |
| assert_equals(e.name, "InvalidAccessError"); |
| assert_equals(e.message, "PresentationRequest::start() requires user gesture."); |
| t.done(); |
| })); |
|
whywhat
2016/12/14 02:20:39
you should probably also have then(t.unreached_fun
zhaobin
2016/12/14 03:00:26
Done.
|
| -}, "Test that the PresentationRequest.start() requires user gesture.") |
| +}; |
| -test(function() { |
| - navigator.presentation.defaultRequest = new PresentationRequest("http://example.com"); |
| +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.
|
| + testUserGesture(t, presentationUrl); |
| +}, "Test that the PresentationRequest.start() with one URL requires user gesture.") |
| + |
| +async_test(function(t) { |
| + testUserGesture(t, presentationUrls); |
| +}, "Test that the PresentationRequest.start() with multiple URLs requires user gesture.") |
| + |
| +var testGarbageCollection = function(requestArgument) { |
| + navigator.presentation.defaultRequest = new PresentationRequest(requestArgument); |
| navigator.presentation.defaultRequest.onconnectionavailable = function() { }; |
| gc(); |
| assert_not_equals(navigator.presentation.defaultRequest.onconnectionavailable, undefined); |
| -}, "Test that navigator.presentation.defaultRequest.onconnectionavailable isn't reset after gc()"); |
| +}; |
| + |
| +test(function() { |
| + testGarbageCollection(presentationUrl); |
| +}, "Test that navigator.presentation.defaultRequest.onconnectionavailable with one URL isn't reset after gc()."); |
| + |
| +test(function() { |
| + testGarbageCollection(presentationUrls); |
| +}, "Test that navigator.presentation.defaultRequest.onconnectionavailable with multiple URLs isn't reset after gc()."); |
| </script> |
| </body> |