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

Side by Side Diff: remoting/host/client_session_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/host/client_session.cc ('k') | remoting/host/host_status_observer.h » ('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 "remoting/host/client_session.h" 5 #include "remoting/host/client_session.h"
6 #include "remoting/host/host_mock_objects.h" 6 #include "remoting/host/host_mock_objects.h"
7 #include "remoting/protocol/protocol_mock_objects.h" 7 #include "remoting/protocol/protocol_mock_objects.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace remoting { 10 namespace remoting {
11 11
12 using protocol::MockConnectionToClient; 12 using protocol::MockConnectionToClient;
13 using protocol::MockConnectionToClientEventHandler; 13 using protocol::MockConnectionToClientEventHandler;
14 using protocol::MockHostStub; 14 using protocol::MockHostStub;
15 using protocol::MockInputStub; 15 using protocol::MockInputStub;
16 using protocol::MockSession; 16 using protocol::MockSession;
17 17
18 using testing::_; 18 using testing::_;
19 using testing::DeleteArg; 19 using testing::DeleteArg;
20 using testing::InSequence; 20 using testing::InSequence;
21 using testing::Return; 21 using testing::Return;
22 using testing::ReturnRef; 22 using testing::ReturnRef;
23 23
24 class ClientSessionTest : public testing::Test { 24 class ClientSessionTest : public testing::Test {
25 public: 25 public:
26 ClientSessionTest() {} 26 ClientSessionTest() {}
27 27
28 virtual void SetUp() { 28 virtual void SetUp() OVERRIDE {
29 client_jid_ = "user@domain/rest-of-jid"; 29 client_jid_ = "user@domain/rest-of-jid";
30 30
31 // Set up a large default screen size that won't affect most tests. 31 // Set up a large default screen size that won't affect most tests.
32 default_screen_size_.set(1000, 1000); 32 default_screen_size_.set(1000, 1000);
33 EXPECT_CALL(capturer_, size_most_recent()) 33 EXPECT_CALL(capturer_, size_most_recent())
34 .WillRepeatedly(ReturnRef(default_screen_size_)); 34 .WillRepeatedly(ReturnRef(default_screen_size_));
35 35
36 protocol::MockSession* session = new MockSession(); 36 protocol::MockSession* session = new MockSession();
37 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); 37 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_));
38 EXPECT_CALL(*session, SetStateChangeCallback(_)); 38 EXPECT_CALL(*session, SetStateChangeCallback(_));
39 39
40 client_session_ = new ClientSession( 40 client_session_ = new ClientSession(
41 &session_event_handler_, 41 &session_event_handler_,
42 new protocol::ConnectionToClient( 42 new protocol::ConnectionToClient(
43 base::MessageLoopProxy::current(), session), 43 base::MessageLoopProxy::current(), session),
44 &input_stub_, &capturer_); 44 &input_stub_, &capturer_);
45 } 45 }
46 46
47 virtual void TearDown() OVERRIDE {
48 client_session_ = NULL;
49 // Run message loop before destroying because protocol::Session is
50 // destroyed asynchronously.
51 message_loop_.RunAllPending();
52 }
53
47 protected: 54 protected:
48 SkISize default_screen_size_; 55 SkISize default_screen_size_;
49 MessageLoop message_loop_; 56 MessageLoop message_loop_;
50 std::string client_jid_; 57 std::string client_jid_;
51 MockHostStub host_stub_; 58 MockHostStub host_stub_;
52 MockInputStub input_stub_; 59 MockInputStub input_stub_;
53 MockCapturer capturer_; 60 MockCapturer capturer_;
54 MockClientSessionEventHandler session_event_handler_; 61 MockClientSessionEventHandler session_event_handler_;
55 scoped_refptr<ClientSession> client_session_; 62 scoped_refptr<ClientSession> client_session_;
56 }; 63 };
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 event.set_x(input_x[i]); 203 event.set_x(input_x[i]);
197 event.set_y(input_y[j]); 204 event.set_y(input_y[j]);
198 EXPECT_CALL(input_stub_, InjectMouseEvent(EqualsMouseEvent( 205 EXPECT_CALL(input_stub_, InjectMouseEvent(EqualsMouseEvent(
199 expected_x[i], expected_y[j]))); 206 expected_x[i], expected_y[j])));
200 client_session_->InjectMouseEvent(event); 207 client_session_->InjectMouseEvent(event);
201 } 208 }
202 } 209 }
203 } 210 }
204 211
205 } // namespace remoting 212 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_session.cc ('k') | remoting/host/host_status_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698