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

Unified Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp

Issue 2338173005: [Blink, RemotePlayback] Dismissing the dialog rejects with NotAllowedError. (Closed)
Patch Set: NON_EXPORTED_BASE Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp
diff --git a/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp b/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..87bfdf0012bc2ccf42e4b311fe4e272f5ee87286
--- /dev/null
+++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp
@@ -0,0 +1,59 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "modules/remoteplayback/RemotePlayback.h"
+
+#include "bindings/core/v8/ExceptionStatePlaceholder.h"
+#include "bindings/core/v8/V8BindingForTesting.h"
+#include "core/html/HTMLMediaElement.h"
+#include "core/html/HTMLVideoElement.h"
+#include "core/testing/DummyPageHolder.h"
+#include "platform/testing/UnitTestHelpers.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+class MockFunction : public ScriptFunction {
+ public:
+ static MockFunction* create(ScriptState* scriptState) {
+ return new MockFunction(scriptState);
+ }
+
+ v8::Local<v8::Function> bind() { return bindToV8Function(); }
+
+ MOCK_METHOD1(call, ScriptValue(ScriptValue));
+
+ private:
+ explicit MockFunction(ScriptState* scriptState)
+ : ScriptFunction(scriptState) {}
+};
+
+class RemotePlaybackTest : public ::testing::Test {
+ protected:
+ void cancelPrompt(RemotePlayback* remotePlayback) {
+ remotePlayback->promptCancelled();
+ }
+};
+
+TEST_F(RemotePlaybackTest, PromptCancelledRejectsWithNotAllowedError) {
+ V8TestingScope scope;
+
+ auto pageHolder = DummyPageHolder::create();
+
+ HTMLMediaElement* element = HTMLVideoElement::create(pageHolder->document());
+ RemotePlayback* remotePlayback = RemotePlayback::create(*element);
+
+ MockFunction* resolve = MockFunction::create(scope.getScriptState());
+ MockFunction* reject = MockFunction::create(scope.getScriptState());
+
+ EXPECT_CALL(*resolve, call(::testing::_)).Times(0);
+ EXPECT_CALL(*reject, call(::testing::_)).Times(1);
+
+ remotePlayback->prompt(scope.getScriptState())
+ .then(resolve->bind(), reject->bind());
+ cancelPrompt(remotePlayback);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698