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

Side by Side Diff: remoting/protocol/connection_to_client_unittest.cc

Issue 8495024: Access ChromotingHost::clients_ only on network thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/connection_to_client.cc ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "remoting/base/base_mock_objects.h" 8 #include "remoting/base/base_mock_objects.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/protocol/fake_session.h" 10 #include "remoting/protocol/fake_session.h"
(...skipping 25 matching lines...) Expand all
36 viewer_->set_input_stub(&input_stub_); 36 viewer_->set_input_stub(&input_stub_);
37 viewer_->SetEventHandler(&handler_); 37 viewer_->SetEventHandler(&handler_);
38 EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get())); 38 EXPECT_CALL(handler_, OnConnectionOpened(viewer_.get()));
39 session_->state_change_callback().Run( 39 session_->state_change_callback().Run(
40 protocol::Session::CONNECTED); 40 protocol::Session::CONNECTED);
41 session_->state_change_callback().Run( 41 session_->state_change_callback().Run(
42 protocol::Session::CONNECTED_CHANNELS); 42 protocol::Session::CONNECTED_CHANNELS);
43 message_loop_.RunAllPending(); 43 message_loop_.RunAllPending();
44 } 44 }
45 45
46 virtual void TearDown() OVERRIDE {
47 viewer_ = NULL;
48 message_loop_.RunAllPending();
49 }
50
46 MessageLoop message_loop_; 51 MessageLoop message_loop_;
47 MockConnectionToClientEventHandler handler_; 52 MockConnectionToClientEventHandler handler_;
48 MockHostStub host_stub_; 53 MockHostStub host_stub_;
49 MockInputStub input_stub_; 54 MockInputStub input_stub_;
50 scoped_refptr<ConnectionToClient> viewer_; 55 scoped_refptr<ConnectionToClient> viewer_;
51 56
52 // Owned by |viewer_|. 57 // Owned by |viewer_|.
53 protocol::FakeSession* session_; 58 protocol::FakeSession* session_;
54 59
55 private: 60 private:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 TEST_F(ConnectionToClientTest, StateChange) { 99 TEST_F(ConnectionToClientTest, StateChange) {
95 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get())); 100 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get()));
96 session_->state_change_callback().Run(protocol::Session::CLOSED); 101 session_->state_change_callback().Run(protocol::Session::CLOSED);
97 message_loop_.RunAllPending(); 102 message_loop_.RunAllPending();
98 103
99 EXPECT_CALL(handler_, OnConnectionFailed(viewer_.get())); 104 EXPECT_CALL(handler_, OnConnectionFailed(viewer_.get()));
100 session_->state_change_callback().Run(protocol::Session::FAILED); 105 session_->state_change_callback().Run(protocol::Session::FAILED);
101 message_loop_.RunAllPending(); 106 message_loop_.RunAllPending();
102 } 107 }
103 108
104 // Test that we can close client connection more than once.
105 TEST_F(ConnectionToClientTest, Close) {
106 viewer_->Disconnect();
107 message_loop_.RunAllPending();
108 viewer_->Disconnect();
109 message_loop_.RunAllPending();
110 }
111
112 } // namespace protocol 109 } // namespace protocol
113 } // namespace remoting 110 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_client.cc ('k') | remoting/protocol/jingle_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698