OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Quits |message_loop_|. | 138 // Quits |message_loop_|. |
139 void QuitMessageLoop(); | 139 void QuitMessageLoop(); |
140 | 140 |
141 void StartDaemonProcess(); | 141 void StartDaemonProcess(); |
142 | 142 |
143 const DaemonProcess::DesktopSessionList& desktop_sessions() const { | 143 const DaemonProcess::DesktopSessionList& desktop_sessions() const { |
144 return daemon_process_->desktop_sessions(); | 144 return daemon_process_->desktop_sessions(); |
145 } | 145 } |
146 | 146 |
147 protected: | 147 protected: |
148 base::MessageLoop message_loop_; | 148 base::MessageLoopForIO message_loop_; |
149 | 149 |
150 scoped_ptr<MockDaemonProcess> daemon_process_; | 150 scoped_ptr<MockDaemonProcess> daemon_process_; |
151 int terminal_id_; | 151 int terminal_id_; |
152 }; | 152 }; |
153 | 153 |
154 DaemonProcessTest::DaemonProcessTest() | 154 DaemonProcessTest::DaemonProcessTest() : terminal_id_(0) { |
155 : message_loop_(base::MessageLoop::TYPE_IO), terminal_id_(0) { | |
156 } | 155 } |
157 | 156 |
158 DaemonProcessTest::~DaemonProcessTest() { | 157 DaemonProcessTest::~DaemonProcessTest() { |
159 } | 158 } |
160 | 159 |
161 void DaemonProcessTest::SetUp() { | 160 void DaemonProcessTest::SetUp() { |
162 scoped_refptr<AutoThreadTaskRunner> task_runner = new AutoThreadTaskRunner( | 161 scoped_refptr<AutoThreadTaskRunner> task_runner = new AutoThreadTaskRunner( |
163 message_loop_.message_loop_proxy(), | 162 message_loop_.message_loop_proxy(), |
164 base::Bind(&DaemonProcessTest::QuitMessageLoop, | 163 base::Bind(&DaemonProcessTest::QuitMessageLoop, |
165 base::Unretained(this))); | 164 base::Unretained(this))); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 EXPECT_EQ(1u, desktop_sessions().size()); | 333 EXPECT_EQ(1u, desktop_sessions().size()); |
335 EXPECT_EQ(id, desktop_sessions().front()->id()); | 334 EXPECT_EQ(id, desktop_sessions().front()->id()); |
336 | 335 |
337 EXPECT_TRUE(daemon_process_->OnMessageReceived( | 336 EXPECT_TRUE(daemon_process_->OnMessageReceived( |
338 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); | 337 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); |
339 EXPECT_TRUE(desktop_sessions().empty()); | 338 EXPECT_TRUE(desktop_sessions().empty()); |
340 EXPECT_EQ(0, terminal_id_); | 339 EXPECT_EQ(0, terminal_id_); |
341 } | 340 } |
342 | 341 |
343 } // namespace remoting | 342 } // namespace remoting |
OLD | NEW |