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

Unified Diff: content/browser/presentation/presentation_service_impl_unittest.cc

Issue 2470023002: [Presentation API] change initial state of PresentationConnection to 'connecting' (Closed)
Patch Set: resolve code review comments from Derek and rebase with master Created 4 years, 1 month 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: content/browser/presentation/presentation_service_impl_unittest.cc
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc
index 73f3dde1d00b56c60105fe3cf9dfe1c974423aad..9374f4a8f8948aee9243b4923e8768f5b850dee9 100644
--- a/content/browser/presentation/presentation_service_impl_unittest.cc
+++ b/content/browser/presentation/presentation_service_impl_unittest.cc
@@ -490,18 +490,24 @@ TEST_F(PresentationServiceImplTest, SetDefaultPresentationUrls) {
run_loop.Run();
}
-TEST_F(PresentationServiceImplTest, ListenForConnectionStateChange) {
+TEST_F(PresentationServiceImplTest,
+ ListenForConnectionStateChangeAndChangeState) {
content::PresentationSessionInfo connection(presentation_url1_,
kPresentationId);
content::PresentationConnectionStateChangedCallback state_changed_cb;
- EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _))
- .WillOnce(SaveArg<3>(&state_changed_cb));
- service_impl_->ListenForConnectionStateChange(connection);
-
// Trigger state change. It should be propagated back up to |mock_client_|.
blink::mojom::PresentationSessionInfo presentation_connection;
presentation_connection.url = presentation_url1_;
presentation_connection.id = kPresentationId;
+
+ EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _))
+ .WillOnce(SaveArg<3>(&state_changed_cb));
+ EXPECT_CALL(mock_client_,
+ OnConnectionStateChanged(
+ SessionInfoEquals(ByRef(presentation_connection)),
+ blink::mojom::PresentationConnectionState::CONNECTED));
+ service_impl_->ListenForConnectionStateChangeAndChangeState(connection);
+
{
base::RunLoop run_loop;
EXPECT_CALL(mock_client_,
@@ -521,7 +527,7 @@ TEST_F(PresentationServiceImplTest, ListenForConnectionClose) {
content::PresentationConnectionStateChangedCallback state_changed_cb;
EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _))
.WillOnce(SaveArg<3>(&state_changed_cb));
- service_impl_->ListenForConnectionStateChange(connection);
+ service_impl_->ListenForConnectionStateChangeAndChangeState(connection);
// Trigger connection close. It should be propagated back up to
// |mock_client_|.

Powered by Google App Engine
This is Rietveld 408576698