| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/remoteplayback/RemotePlayback.h" | 5 #include "modules/remoteplayback/RemotePlayback.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 8 #include "bindings/core/v8/V8BindingForTesting.h" | 8 #include "bindings/core/v8/V8BindingForTesting.h" |
| 9 #include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h" | 9 #include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h" |
| 10 #include "core/dom/DocumentUserGestureToken.h" | 10 #include "core/dom/DocumentUserGestureToken.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 V8TestingScope scope; | 143 V8TestingScope scope; |
| 144 | 144 |
| 145 auto pageHolder = DummyPageHolder::create(); | 145 auto pageHolder = DummyPageHolder::create(); |
| 146 | 146 |
| 147 HTMLMediaElement* element = HTMLVideoElement::create(pageHolder->document()); | 147 HTMLMediaElement* element = HTMLVideoElement::create(pageHolder->document()); |
| 148 RemotePlayback* remotePlayback = | 148 RemotePlayback* remotePlayback = |
| 149 HTMLMediaElementRemotePlayback::remote(scope.getScriptState(), *element); | 149 HTMLMediaElementRemotePlayback::remote(scope.getScriptState(), *element); |
| 150 | 150 |
| 151 MockFunction* callbackFunction = MockFunction::create(scope.getScriptState()); | 151 MockFunction* callbackFunction = MockFunction::create(scope.getScriptState()); |
| 152 RemotePlaybackAvailabilityCallback* availabilityCallback = | 152 RemotePlaybackAvailabilityCallback* availabilityCallback = |
| 153 RemotePlaybackAvailabilityCallback::create(scope.isolate(), | 153 RemotePlaybackAvailabilityCallback::create(scope.getScriptState(), |
| 154 callbackFunction->bind()); | 154 callbackFunction->bind()); |
| 155 | 155 |
| 156 // The initial call upon registering will not happen as it's posted on the | 156 // The initial call upon registering will not happen as it's posted on the |
| 157 // message loop. | 157 // message loop. |
| 158 EXPECT_CALL(*callbackFunction, call(::testing::_)).Times(0); | 158 EXPECT_CALL(*callbackFunction, call(::testing::_)).Times(0); |
| 159 | 159 |
| 160 MockFunction* watchResolve = MockFunction::create(scope.getScriptState()); | 160 MockFunction* watchResolve = MockFunction::create(scope.getScriptState()); |
| 161 MockFunction* watchReject = MockFunction::create(scope.getScriptState()); | 161 MockFunction* watchReject = MockFunction::create(scope.getScriptState()); |
| 162 | 162 |
| 163 EXPECT_CALL(*watchResolve, call(::testing::_)).Times(1); | 163 EXPECT_CALL(*watchResolve, call(::testing::_)).Times(1); |
| 164 EXPECT_CALL(*watchReject, call(::testing::_)).Times(0); | 164 EXPECT_CALL(*watchReject, call(::testing::_)).Times(0); |
| 165 | 165 |
| 166 remotePlayback->watchAvailability(availabilityCallback) | 166 remotePlayback->watchAvailability(availabilityCallback) |
| 167 .then(watchResolve->bind(), watchReject->bind()); | 167 .then(watchResolve->bind(), watchReject->bind()); |
| 168 | 168 |
| 169 HTMLMediaElementRemotePlayback::setBooleanAttribute( | 169 HTMLMediaElementRemotePlayback::setBooleanAttribute( |
| 170 HTMLNames::disableremoteplaybackAttr, *element, true); | 170 HTMLNames::disableremoteplaybackAttr, *element, true); |
| 171 setAvailability(remotePlayback, true); | 171 setAvailability(remotePlayback, true); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |