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

Side by Side Diff: remoting/host/chromoting_host_unittest.cc

Issue 7262015: Conenct Chromoting plugin debug log to JS UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/plugin/host_plugin_logger.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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/task.h" 7 #include "base/task.h"
8 #include "remoting/base/logger.h"
8 #include "remoting/host/capturer_fake.h" 9 #include "remoting/host/capturer_fake.h"
9 #include "remoting/host/chromoting_host.h" 10 #include "remoting/host/chromoting_host.h"
10 #include "remoting/host/chromoting_host_context.h" 11 #include "remoting/host/chromoting_host_context.h"
11 #include "remoting/host/host_mock_objects.h" 12 #include "remoting/host/host_mock_objects.h"
12 #include "remoting/host/in_memory_host_config.h" 13 #include "remoting/host/in_memory_host_config.h"
13 #include "remoting/proto/video.pb.h" 14 #include "remoting/proto/video.pb.h"
14 #include "remoting/protocol/protocol_mock_objects.h" 15 #include "remoting/protocol/protocol_mock_objects.h"
15 #include "remoting/protocol/session_config.h" 16 #include "remoting/protocol/session_config.h"
16 #include "testing/gmock_mutant.h" 17 #include "testing/gmock_mutant.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 .WillByDefault(Return(&message_loop_)); 80 .WillByDefault(Return(&message_loop_));
80 EXPECT_CALL(context_, main_message_loop()) 81 EXPECT_CALL(context_, main_message_loop())
81 .Times(AnyNumber()); 82 .Times(AnyNumber());
82 EXPECT_CALL(context_, encode_message_loop()) 83 EXPECT_CALL(context_, encode_message_loop())
83 .Times(AnyNumber()); 84 .Times(AnyNumber());
84 EXPECT_CALL(context_, network_message_loop()) 85 EXPECT_CALL(context_, network_message_loop())
85 .Times(AnyNumber()); 86 .Times(AnyNumber());
86 EXPECT_CALL(context_, ui_message_loop()) 87 EXPECT_CALL(context_, ui_message_loop())
87 .Times(AnyNumber()); 88 .Times(AnyNumber());
88 89
90 logger_.reset(new Logger());
91
89 context_.SetUITaskPostFunction(base::Bind( 92 context_.SetUITaskPostFunction(base::Bind(
90 static_cast<void(MessageLoop::*)( 93 static_cast<void(MessageLoop::*)(
91 const tracked_objects::Location&, Task*)>(&MessageLoop::PostTask), 94 const tracked_objects::Location&, Task*)>(&MessageLoop::PostTask),
92 base::Unretained(&message_loop_))); 95 base::Unretained(&message_loop_)));
93 96
94 Capturer* capturer = new CapturerFake(); 97 Capturer* capturer = new CapturerFake();
95 event_executor_ = new MockEventExecutor(); 98 event_executor_ = new MockEventExecutor();
96 curtain_ = new MockCurtain(); 99 curtain_ = new MockCurtain();
97 disconnect_window_ = new MockDisconnectWindow(); 100 disconnect_window_ = new MockDisconnectWindow();
98 continue_window_ = new MockContinueWindow(); 101 continue_window_ = new MockContinueWindow();
99 local_input_monitor_ = new MockLocalInputMonitor(); 102 local_input_monitor_ = new MockLocalInputMonitor();
100 DesktopEnvironment* desktop = 103 DesktopEnvironment* desktop =
101 new DesktopEnvironment(&context_, capturer, event_executor_, curtain_, 104 new DesktopEnvironment(&context_, capturer, event_executor_, curtain_,
102 disconnect_window_, continue_window_, 105 disconnect_window_, continue_window_,
103 local_input_monitor_); 106 local_input_monitor_);
104 MockAccessVerifier* access_verifier = new MockAccessVerifier(); 107 MockAccessVerifier* access_verifier = new MockAccessVerifier();
105 108
106 host_ = ChromotingHost::Create(&context_, config_, 109 host_ = ChromotingHost::Create(&context_, config_,
107 desktop, access_verifier); 110 desktop, access_verifier, logger_.get());
108 credentials_.set_type(protocol::PASSWORD); 111 credentials_.set_type(protocol::PASSWORD);
109 credentials_.set_username("user"); 112 credentials_.set_username("user");
110 credentials_.set_credential("password"); 113 credentials_.set_credential("password");
111 connection_ = new MockConnectionToClient( 114 connection_ = new MockConnectionToClient(
112 &message_loop_, &handler_, &host_stub_, event_executor_); 115 &message_loop_, &handler_, &host_stub_, event_executor_);
113 connection2_ = new MockConnectionToClient( 116 connection2_ = new MockConnectionToClient(
114 &message_loop_, &handler_, &host_stub2_, &event_executor2_); 117 &message_loop_, &handler_, &host_stub2_, &event_executor2_);
115 session_.reset(new MockSession()); 118 session_.reset(new MockSession());
116 session2_.reset(new MockSession()); 119 session2_.reset(new MockSession());
117 session_config_.reset(SessionConfig::CreateDefault()); 120 session_config_.reset(SessionConfig::CreateDefault());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 scoped_refptr<ClientSession> session) { 201 scoped_refptr<ClientSession> session) {
199 host->clients_.push_back(session); 202 host->clients_.push_back(session);
200 } 203 }
201 204
202 void ShutdownHost() { 205 void ShutdownHost() {
203 host_->Shutdown( 206 host_->Shutdown(
204 NewRunnableFunction(&PostQuitTask, &message_loop_)); 207 NewRunnableFunction(&PostQuitTask, &message_loop_));
205 } 208 }
206 209
207 protected: 210 protected:
211 scoped_ptr<Logger> logger_;
208 MessageLoop message_loop_; 212 MessageLoop message_loop_;
209 MockConnectionToClientEventHandler handler_; 213 MockConnectionToClientEventHandler handler_;
210 scoped_refptr<ChromotingHost> host_; 214 scoped_refptr<ChromotingHost> host_;
211 scoped_refptr<InMemoryHostConfig> config_; 215 scoped_refptr<InMemoryHostConfig> config_;
212 MockChromotingHostContext context_; 216 MockChromotingHostContext context_;
213 protocol::LocalLoginCredentials credentials_; 217 protocol::LocalLoginCredentials credentials_;
214 scoped_refptr<MockConnectionToClient> connection_; 218 scoped_refptr<MockConnectionToClient> connection_;
215 scoped_ptr<MockSession> session_; 219 scoped_ptr<MockSession> session_;
216 scoped_ptr<SessionConfig> session_config_; 220 scoped_ptr<SessionConfig> session_config_;
217 MockVideoStub video_stub_; 221 MockVideoStub video_stub_;
218 MockClientStub client_stub_; 222 MockClientStub client_stub_;
219 MockHostStub host_stub_; 223 MockHostStub host_stub_;
220 scoped_refptr<MockConnectionToClient> connection2_; 224 scoped_refptr<MockConnectionToClient> connection2_;
221 scoped_ptr<MockSession> session2_; 225 scoped_ptr<MockSession> session2_;
222 scoped_ptr<SessionConfig> session_config2_; 226 scoped_ptr<SessionConfig> session_config2_;
223 MockVideoStub video_stub2_; 227 MockVideoStub video_stub2_;
224 MockClientStub client_stub2_; 228 MockClientStub client_stub2_;
225 MockHostStub host_stub2_; 229 MockHostStub host_stub2_;
226 MockEventExecutor event_executor2_; 230 MockEventExecutor event_executor2_;
227 231
228 // Owned by |host_|. 232 // Owned by |host_|.
229 MockEventExecutor* event_executor_; 233 MockEventExecutor* event_executor_;
230 MockCurtain* curtain_; 234 MockCurtain* curtain_;
231 MockDisconnectWindow* disconnect_window_; 235 MockDisconnectWindow* disconnect_window_;
232 ContinueWindow* continue_window_; 236 MockContinueWindow* continue_window_;
233 MockLocalInputMonitor* local_input_monitor_; 237 MockLocalInputMonitor* local_input_monitor_;
234 }; 238 };
235 239
236 TEST_F(ChromotingHostTest, DISABLED_StartAndShutdown) { 240 TEST_F(ChromotingHostTest, DISABLED_StartAndShutdown) {
237 host_->Start(); 241 host_->Start();
238 242
239 message_loop_.PostTask( 243 message_loop_.PostTask(
240 FROM_HERE,NewRunnableMethod( 244 FROM_HERE,NewRunnableMethod(
241 host_.get(), &ChromotingHost::Shutdown, 245 host_.get(), &ChromotingHost::Shutdown,
242 NewRunnableFunction(&PostQuitTask, &message_loop_))); 246 NewRunnableFunction(&PostQuitTask, &message_loop_)));
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 EXPECT_CALL(*connection_.get(), Disconnect()) 491 EXPECT_CALL(*connection_.get(), Disconnect())
488 .InSequence(s1, s2) 492 .InSequence(s1, s2)
489 .RetiresOnSaturation(); 493 .RetiresOnSaturation();
490 } 494 }
491 SimulateClientConnection(0, true); 495 SimulateClientConnection(0, true);
492 message_loop_.Run(); 496 message_loop_.Run();
493 host_->set_it2me(false); 497 host_->set_it2me(false);
494 EXPECT_THAT(curtain_activated, false); 498 EXPECT_THAT(curtain_activated, false);
495 } 499 }
496 } // namespace remoting 500 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/plugin/host_plugin_logger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698