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

Unified Diff: remoting/protocol/connection_to_client_unittest.cc

Issue 902613004: Fix ConnectionToClient to connect stubs only after authentication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_pump
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/connection_to_client_unittest.cc
diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc
index e123cfaf0db922a7a6492d43de476d2977d6ac2f..5a7dd9be384f1b1cd492b4368b8aca93e678ffc0 100644
--- a/remoting/protocol/connection_to_client_unittest.cc
+++ b/remoting/protocol/connection_to_client_unittest.cc
@@ -14,6 +14,7 @@
#include "testing/gmock/include/gmock/gmock.h"
using ::testing::_;
+using ::testing::InvokeWithoutArgs;
using ::testing::NotNull;
using ::testing::StrictMock;
@@ -31,11 +32,10 @@ class ConnectionToClientTest : public testing::Test {
// Allocate a ClientConnection object with the mock objects.
viewer_.reset(new ConnectionToClient(session_));
- viewer_->set_clipboard_stub(&clipboard_stub_);
- viewer_->set_host_stub(&host_stub_);
- viewer_->set_input_stub(&input_stub_);
viewer_->SetEventHandler(&handler_);
- EXPECT_CALL(handler_, OnConnectionAuthenticated(viewer_.get()));
+ EXPECT_CALL(handler_, OnConnectionAuthenticated(viewer_.get()))
+ .WillOnce(
+ InvokeWithoutArgs(this, &ConnectionToClientTest::ConnectStubs));
EXPECT_CALL(handler_, OnConnectionChannelsConnected(viewer_.get()));
session_->event_handler()->OnSessionStateChange(Session::CONNECTED);
session_->event_handler()->OnSessionStateChange(Session::AUTHENTICATED);
@@ -47,6 +47,12 @@ class ConnectionToClientTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
+ void ConnectStubs() {
+ viewer_->set_clipboard_stub(&clipboard_stub_);
+ viewer_->set_host_stub(&host_stub_);
+ viewer_->set_input_stub(&input_stub_);
+ }
+
base::MessageLoop message_loop_;
MockConnectionToClientEventHandler handler_;
MockClipboardStub clipboard_stub_;

Powered by Google App Engine
This is Rietveld 408576698