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

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

Issue 2874483002: [Presentation API] Remove closed connections from PresentationConnectionList (Closed)
Patch Set: rebase with master Created 3 years, 7 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
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 <memory> 7 #include <memory>
8 8
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/V8BindingForTesting.h" 10 #include "bindings/core/v8/V8BindingForTesting.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 TEST_F(PresentationReceiverTest, CreateReceiver) { 223 TEST_F(PresentationReceiverTest, CreateReceiver) {
224 MockWebPresentationClient client; 224 MockWebPresentationClient client;
225 EXPECT_CALL(client, SetReceiver(testing::_)); 225 EXPECT_CALL(client, SetReceiver(testing::_));
226 226
227 V8TestingScope scope; 227 V8TestingScope scope;
228 new PresentationReceiver(&scope.GetFrame(), &client); 228 new PresentationReceiver(&scope.GetFrame(), &client);
229 } 229 }
230 230
231 TEST_F(PresentationReceiverTest, TestRemoveConnection) {
232 V8TestingScope scope;
233 auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr);
234
235 // Receive first connection.
236 WebPresentationInfo presentation_info1(KURL(KURL(), "http://example1.com"),
237 "id1");
238 auto* connection1 =
239 receiver->OnReceiverConnectionAvailable(presentation_info1);
240 EXPECT_TRUE(connection1);
241
242 // Receive second connection.
243 WebPresentationInfo presentation_info2(KURL(KURL(), "http://example2.com"),
244 "id2");
245 auto* connection2 =
246 receiver->OnReceiverConnectionAvailable(presentation_info2);
247 EXPECT_TRUE(connection2);
248
249 receiver->connectionList(scope.GetScriptState());
250 VerifyConnectionListSize(2, receiver);
251
252 receiver->RemoveConnection(connection1);
253 VerifyConnectionListSize(1, receiver);
254 }
255
231 } // namespace blink 256 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698