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

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

Issue 7355011: Modify Chromoting logging to hook into base logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 4 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"
9 #include "remoting/host/capturer_fake.h" 8 #include "remoting/host/capturer_fake.h"
10 #include "remoting/host/chromoting_host.h" 9 #include "remoting/host/chromoting_host.h"
11 #include "remoting/host/chromoting_host_context.h" 10 #include "remoting/host/chromoting_host_context.h"
12 #include "remoting/host/host_mock_objects.h" 11 #include "remoting/host/host_mock_objects.h"
13 #include "remoting/host/in_memory_host_config.h" 12 #include "remoting/host/in_memory_host_config.h"
14 #include "remoting/proto/video.pb.h" 13 #include "remoting/proto/video.pb.h"
15 #include "remoting/protocol/protocol_mock_objects.h" 14 #include "remoting/protocol/protocol_mock_objects.h"
16 #include "remoting/protocol/session_config.h" 15 #include "remoting/protocol/session_config.h"
17 #include "testing/gmock_mutant.h" 16 #include "testing/gmock_mutant.h"
18 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 .WillByDefault(Return(&message_loop_)); 79 .WillByDefault(Return(&message_loop_));
81 EXPECT_CALL(context_, main_message_loop()) 80 EXPECT_CALL(context_, main_message_loop())
82 .Times(AnyNumber()); 81 .Times(AnyNumber());
83 EXPECT_CALL(context_, encode_message_loop()) 82 EXPECT_CALL(context_, encode_message_loop())
84 .Times(AnyNumber()); 83 .Times(AnyNumber());
85 EXPECT_CALL(context_, network_message_loop()) 84 EXPECT_CALL(context_, network_message_loop())
86 .Times(AnyNumber()); 85 .Times(AnyNumber());
87 EXPECT_CALL(context_, ui_message_loop()) 86 EXPECT_CALL(context_, ui_message_loop())
88 .Times(AnyNumber()); 87 .Times(AnyNumber());
89 88
90 logger_.reset(new Logger());
91
92 context_.SetUITaskPostFunction(base::Bind( 89 context_.SetUITaskPostFunction(base::Bind(
93 static_cast<void(MessageLoop::*)( 90 static_cast<void(MessageLoop::*)(
94 const tracked_objects::Location&, 91 const tracked_objects::Location&,
95 const base::Closure&)>(&MessageLoop::PostTask), 92 const base::Closure&)>(&MessageLoop::PostTask),
96 base::Unretained(&message_loop_))); 93 base::Unretained(&message_loop_)));
97 94
98 Capturer* capturer = new CapturerFake(); 95 Capturer* capturer = new CapturerFake();
99 event_executor_ = new MockEventExecutor(); 96 event_executor_ = new MockEventExecutor();
100 curtain_ = new MockCurtain(); 97 curtain_ = new MockCurtain();
101 disconnect_window_ = new MockDisconnectWindow(); 98 disconnect_window_ = new MockDisconnectWindow();
102 continue_window_ = new MockContinueWindow(); 99 continue_window_ = new MockContinueWindow();
103 local_input_monitor_ = new MockLocalInputMonitor(); 100 local_input_monitor_ = new MockLocalInputMonitor();
104 desktop_environment_.reset( 101 desktop_environment_.reset(
105 new DesktopEnvironment(&context_, capturer, event_executor_, curtain_, 102 new DesktopEnvironment(&context_, capturer, event_executor_, curtain_,
106 disconnect_window_, continue_window_, 103 disconnect_window_, continue_window_,
107 local_input_monitor_)); 104 local_input_monitor_));
108 MockAccessVerifier* access_verifier = new MockAccessVerifier(); 105 MockAccessVerifier* access_verifier = new MockAccessVerifier();
109 106
110 host_ = ChromotingHost::Create(&context_, config_, 107 host_ = ChromotingHost::Create(&context_, config_,
111 desktop_environment_.get(), 108 desktop_environment_.get(),
112 access_verifier, logger_.get(), false); 109 access_verifier, false);
113 credentials_.set_type(protocol::PASSWORD); 110 credentials_.set_type(protocol::PASSWORD);
114 credentials_.set_username("user"); 111 credentials_.set_username("user");
115 credentials_.set_credential("password"); 112 credentials_.set_credential("password");
116 connection_ = new MockConnectionToClient( 113 connection_ = new MockConnectionToClient(
117 &message_loop_, &handler_, &host_stub_, event_executor_); 114 &message_loop_, &handler_, &host_stub_, event_executor_);
118 connection2_ = new MockConnectionToClient( 115 connection2_ = new MockConnectionToClient(
119 &message_loop_, &handler_, &host_stub2_, &event_executor2_); 116 &message_loop_, &handler_, &host_stub2_, &event_executor2_);
120 session_.reset(new MockSession()); 117 session_.reset(new MockSession());
121 session2_.reset(new MockSession()); 118 session2_.reset(new MockSession());
122 session_config_.reset(SessionConfig::CreateDefault()); 119 session_config_.reset(SessionConfig::CreateDefault());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 scoped_refptr<ClientSession> session) { 204 scoped_refptr<ClientSession> session) {
208 host->clients_.push_back(session); 205 host->clients_.push_back(session);
209 } 206 }
210 207
211 void ShutdownHost() { 208 void ShutdownHost() {
212 host_->Shutdown( 209 host_->Shutdown(
213 NewRunnableFunction(&PostQuitTask, &message_loop_)); 210 NewRunnableFunction(&PostQuitTask, &message_loop_));
214 } 211 }
215 212
216 protected: 213 protected:
217 scoped_ptr<Logger> logger_;
218 MessageLoop message_loop_; 214 MessageLoop message_loop_;
219 MockConnectionToClientEventHandler handler_; 215 MockConnectionToClientEventHandler handler_;
220 scoped_ptr<DesktopEnvironment> desktop_environment_; 216 scoped_ptr<DesktopEnvironment> desktop_environment_;
221 scoped_refptr<ChromotingHost> host_; 217 scoped_refptr<ChromotingHost> host_;
222 scoped_refptr<InMemoryHostConfig> config_; 218 scoped_refptr<InMemoryHostConfig> config_;
223 MockChromotingHostContext context_; 219 MockChromotingHostContext context_;
224 protocol::LocalLoginCredentials credentials_; 220 protocol::LocalLoginCredentials credentials_;
225 scoped_refptr<MockConnectionToClient> connection_; 221 scoped_refptr<MockConnectionToClient> connection_;
226 scoped_ptr<MockSession> session_; 222 scoped_ptr<MockSession> session_;
227 scoped_ptr<SessionConfig> session_config_; 223 scoped_ptr<SessionConfig> session_config_;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 EXPECT_CALL(*connection_.get(), Disconnect()) 494 EXPECT_CALL(*connection_.get(), Disconnect())
499 .InSequence(s1, s2) 495 .InSequence(s1, s2)
500 .RetiresOnSaturation(); 496 .RetiresOnSaturation();
501 } 497 }
502 SimulateClientConnection(0, true); 498 SimulateClientConnection(0, true);
503 message_loop_.Run(); 499 message_loop_.Run();
504 host_->set_it2me(false); 500 host_->set_it2me(false);
505 EXPECT_THAT(curtain_activated, false); 501 EXPECT_THAT(curtain_activated, false);
506 } 502 }
507 } // namespace remoting 503 } // 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