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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp
index f031b9015b3ed60a1999d871d159bffe1b5c3253..c62ecfd7fa84d43626db782ab222511adca18cbb 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationReceiverTest.cpp
@@ -228,4 +228,29 @@ TEST_F(PresentationReceiverTest, CreateReceiver) {
new PresentationReceiver(&scope.GetFrame(), &client);
}
+TEST_F(PresentationReceiverTest, TestRemoveConnection) {
+ V8TestingScope scope;
+ auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr);
+
+ // Receive first connection.
+ WebPresentationInfo presentation_info1(KURL(KURL(), "http://example1.com"),
+ "id1");
+ auto* connection1 =
+ receiver->OnReceiverConnectionAvailable(presentation_info1);
+ EXPECT_TRUE(connection1);
+
+ // Receive second connection.
+ WebPresentationInfo presentation_info2(KURL(KURL(), "http://example2.com"),
+ "id2");
+ auto* connection2 =
+ receiver->OnReceiverConnectionAvailable(presentation_info2);
+ EXPECT_TRUE(connection2);
+
+ receiver->connectionList(scope.GetScriptState());
+ VerifyConnectionListSize(2, receiver);
+
+ receiver->RemoveConnection(connection1);
+ VerifyConnectionListSize(1, receiver);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698