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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp

Issue 2706453002: [Presentation API] return valid WebPresentationConnection object in PresentationReceiver (Closed)
Patch Set: resolve code review comments from Derek Created 3 years, 10 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/presentation/PresentationReceiver.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
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/presentation/PresentationReceiver.h" 5 #include "modules/presentation/PresentationReceiver.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/testing/DummyPageHolder.h" 10 #include "core/testing/DummyPageHolder.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 auto receiver = new PresentationReceiver(&scope.frame(), nullptr); 195 auto receiver = new PresentationReceiver(&scope.frame(), nullptr);
196 196
197 StrictMock<MockEventListener>* eventHandler = 197 StrictMock<MockEventListener>* eventHandler =
198 new StrictMock<MockEventListener>(); 198 new StrictMock<MockEventListener>();
199 addConnectionavailableEventListener(eventHandler, receiver); 199 addConnectionavailableEventListener(eventHandler, receiver);
200 EXPECT_CALL(*eventHandler, handleEvent(testing::_, testing::_)).Times(0); 200 EXPECT_CALL(*eventHandler, handleEvent(testing::_, testing::_)).Times(0);
201 201
202 WebPresentationSessionInfo sessionInfo(KURL(KURL(), "http://example.com"), 202 WebPresentationSessionInfo sessionInfo(KURL(KURL(), "http://example.com"),
203 "id"); 203 "id");
204 // Receive first connection. 204 // Receive first connection.
205 receiver->onReceiverConnectionAvailable(sessionInfo); 205 auto* connection1 = receiver->onReceiverConnectionAvailable(sessionInfo);
206 EXPECT_TRUE(connection1);
207
206 // Receive second connection. 208 // Receive second connection.
207 receiver->onReceiverConnectionAvailable(sessionInfo); 209 auto* connection2 = receiver->onReceiverConnectionAvailable(sessionInfo);
210 EXPECT_TRUE(connection2);
208 211
209 receiver->connectionList(scope.getScriptState()); 212 receiver->connectionList(scope.getScriptState());
210 verifyConnectionListPropertyState(ScriptPromisePropertyBase::Resolved, 213 verifyConnectionListPropertyState(ScriptPromisePropertyBase::Resolved,
211 receiver); 214 receiver);
212 verifyConnectionListSize(2, receiver); 215 verifyConnectionListSize(2, receiver);
213 } 216 }
214 217
215 TEST_F(PresentationReceiverTest, CreateReceiver) { 218 TEST_F(PresentationReceiverTest, CreateReceiver) {
216 MockWebPresentationClient client; 219 MockWebPresentationClient client;
217 EXPECT_CALL(client, setReceiver(testing::_)); 220 EXPECT_CALL(client, setReceiver(testing::_));
218 221
219 V8TestingScope scope; 222 V8TestingScope scope;
220 new PresentationReceiver(&scope.frame(), &client); 223 new PresentationReceiver(&scope.frame(), &client);
221 } 224 }
222 225
223 } // namespace blink 226 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698