diff options
author | simonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-24 01:13:33 +0000 |
---|---|---|
committer | simonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-24 01:13:33 +0000 |
commit | 04b6e792a069097a6e8f4729c614a888027db626 (patch) | |
tree | 64ed5e40efdc357af006e995fc35f866218d2130 | |
parent | d77fcb3714b0f93bec713392661d02153e016a5c (diff) | |
download | chromium_src-04b6e792a069097a6e8f4729c614a888027db626.zip chromium_src-04b6e792a069097a6e8f4729c614a888027db626.tar.gz chromium_src-04b6e792a069097a6e8f4729c614a888027db626.tar.bz2 |
[Chromoting] Tighten up unit tests.
The result is that GMock stops complaining about uninteresting
mock function calls.
This CL also prevents a NOTIMPLEMENTED error in fake_session.
Review URL: https://chromiumcodereview.appspot.com/10430006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138681 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/host/client_session_unittest.cc | 6 | ||||
-rw-r--r-- | remoting/host/screen_recorder_unittest.cc | 2 | ||||
-rw-r--r-- | remoting/protocol/fake_session.cc | 4 | ||||
-rw-r--r-- | remoting/protocol/fake_session.h | 7 |
4 files changed, 14 insertions, 5 deletions
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index 170850e..33779c0 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc @@ -37,7 +37,8 @@ class ClientSessionTest : public testing::Test { protocol::MockSession* session = new MockSession(); EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); EXPECT_CALL(*session, SetStateChangeCallback(_)); - + EXPECT_CALL(*session, SetRouteChangeCallback(_)); + EXPECT_CALL(*session, Close()); scoped_ptr<protocol::ConnectionToClient> connection( new protocol::ConnectionToClient(session)); client_session_.reset(new ClientSession( @@ -252,6 +253,7 @@ TEST_F(ClientSessionTest, ClampMouseEvents) { EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); + EXPECT_CALL(session_event_handler_, OnSessionClosed(_)); client_session_->OnConnectionAuthenticated(client_session_->connection()); client_session_->OnConnectionChannelsConnected(client_session_->connection()); @@ -271,6 +273,8 @@ TEST_F(ClientSessionTest, ClampMouseEvents) { client_session_->InjectMouseEvent(event); } } + + DisconnectClientSession(); } } // namespace remoting diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc index b1b49ee..3457444 100644 --- a/remoting/host/screen_recorder_unittest.cc +++ b/remoting/host/screen_recorder_unittest.cc @@ -78,6 +78,7 @@ class ScreenRecorderTest : public testing::Test { session_ = new MockSession(); EXPECT_CALL(*session_, SetStateChangeCallback(_)); + EXPECT_CALL(*session_, SetRouteChangeCallback(_)); EXPECT_CALL(*session_, Close()) .Times(AnyNumber()); connection_.reset(new MockConnectionToClient( @@ -171,6 +172,7 @@ TEST_F(ScreenRecorderTest, StartAndStop) { } TEST_F(ScreenRecorderTest, StopWithoutStart) { + EXPECT_CALL(capturer_, Stop()); record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); message_loop_.Run(); } diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc index 44fbba8..8f71795 100644 --- a/remoting/protocol/fake_session.cc +++ b/remoting/protocol/fake_session.cc @@ -245,11 +245,11 @@ FakeUdpSocket* FakeSession::GetDatagramChannel(const std::string& name) { } void FakeSession::SetStateChangeCallback(const StateChangeCallback& callback) { - callback_ = callback; + state_change_callback_ = callback; } void FakeSession::SetRouteChangeCallback(const RouteChangeCallback& callback) { - NOTIMPLEMENTED(); + route_change_callback_ = callback; } ErrorCode FakeSession::error() { diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h index 42148a2..70bcfa1 100644 --- a/remoting/protocol/fake_session.h +++ b/remoting/protocol/fake_session.h @@ -135,7 +135,9 @@ class FakeSession : public Session { FakeSession(); virtual ~FakeSession(); - const StateChangeCallback& state_change_callback() { return callback_; } + const StateChangeCallback& state_change_callback() { + return state_change_callback_; + } void set_message_loop(MessageLoop* message_loop) { message_loop_ = message_loop; @@ -173,7 +175,8 @@ class FakeSession : public Session { virtual void Close() OVERRIDE; public: - StateChangeCallback callback_; + StateChangeCallback state_change_callback_; + RouteChangeCallback route_change_callback_; scoped_ptr<const CandidateSessionConfig> candidate_config_; SessionConfig config_; MessageLoop* message_loop_; |