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

Side by Side Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlaybackTest.cpp

Issue 2338173005: [Blink, RemotePlayback] Dismissing the dialog rejects with NotAllowedError. (Closed)
Patch Set: Added modules export to RemotePlayback 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "modules/remoteplayback/RemotePlayback.h"
6
7 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "core/html/HTMLMediaElement.h"
10 #include "core/testing/DummyPageHolder.h"
11 #include "platform/testing/UnitTestHelpers.h"
12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace blink {
16
17 class MockFunction : public ScriptFunction {
18 public:
19 explicit MockFunction(ScriptState* scriptState) : ScriptFunction(scriptState )
20 {
21 }
22
23 MOCK_METHOD1(call, ScriptValue(ScriptValue));
24
25 v8::Local<v8::Function> bind()
26 {
27 return bindToV8Function();
28 }
29 };
30
31 class RemotePlaybackTest : public ::testing::Test {
32 protected:
33 void cancelPrompt(RemotePlayback* remotePlayback)
34 {
35 remotePlayback->promptCancelled();
36 };
mlamouri (slow - plz ping) 2016/10/01 14:56:30 Don't think this ; is needed.
whywhat 2016/10/04 19:23:45 Done.
37 };
38
39 TEST_F(RemotePlaybackTest, PromptCancelledRejectsWithNotAllowedError)
40 {
41 auto pageHolder = DummyPageHolder::create();
42 auto documentBody = pageHolder->document().body();
mlamouri (slow - plz ping) 2016/10/01 14:56:30 style: I'm not 100% sure this is style-required bu
whywhat 2016/10/04 19:23:45 DummyPageHolder::create seems fine (returns a smar
43 documentBody->setInnerHTML("<video>", ASSERT_NO_EXCEPTION);
44 testing::runPendingTasks();
45
46 HTMLMediaElement* element = toHTMLMediaElement(documentBody->firstChild());
mlamouri (slow - plz ping) 2016/10/01 14:56:30 Instead of adding a video element to the document
whywhat 2016/10/04 19:23:45 Yep, that's better.
47 auto remotePlayback = RemotePlayback::create(*element);
mlamouri (slow - plz ping) 2016/10/01 14:56:30 ditto
whywhat 2016/10/04 19:23:45 Done.
48
49 V8TestingScope scope;
50
51 MockFunction resolve(scope.getScriptState());
52 MockFunction reject(scope.getScriptState());
53
54 EXPECT_CALL(resolve, call(::testing::_)).Times(0);
55 EXPECT_CALL(reject, call(::testing::_)).Times(1);
56
57 remotePlayback->prompt(scope.getScriptState()).then(
58 resolve.bind(), reject.bind());
59 cancelPrompt(remotePlayback);
60 }
61
62 } // namespace blink
OLDNEW
« 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