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 "remoting/host/desktop_process.h" | 5 #include "remoting/host/desktop_process.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "remoting/host/host_exit_codes.h" | 23 #include "remoting/host/host_exit_codes.h" |
24 #include "remoting/host/host_mock_objects.h" | 24 #include "remoting/host/host_mock_objects.h" |
25 #include "remoting/host/screen_resolution.h" | 25 #include "remoting/host/screen_resolution.h" |
26 #include "remoting/protocol/protocol_mock_objects.h" | 26 #include "remoting/protocol/protocol_mock_objects.h" |
27 #include "testing/gmock_mutant.h" | 27 #include "testing/gmock_mutant.h" |
28 #include "testing/gmock/include/gmock/gmock.h" | 28 #include "testing/gmock/include/gmock/gmock.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 | 30 |
31 using testing::_; | 31 using testing::_; |
32 using testing::AnyNumber; | 32 using testing::AnyNumber; |
| 33 using testing::AtMost; |
33 using testing::InSequence; | 34 using testing::InSequence; |
34 using testing::Return; | 35 using testing::Return; |
35 | 36 |
36 namespace remoting { | 37 namespace remoting { |
37 | 38 |
38 namespace { | 39 namespace { |
39 | 40 |
40 class MockDaemonListener : public IPC::Listener { | 41 class MockDaemonListener : public IPC::Listener { |
41 public: | 42 public: |
42 MockDaemonListener() {} | 43 MockDaemonListener() {} |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 192 |
192 base::ClosePlatformFile(desktop_process.fd); | 193 base::ClosePlatformFile(desktop_process.fd); |
193 #endif // defined(OS_POSIX) | 194 #endif // defined(OS_POSIX) |
194 } | 195 } |
195 | 196 |
196 DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() { | 197 DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() { |
197 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); | 198 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); |
198 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) | 199 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) |
199 .Times(0); | 200 .Times(0); |
200 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) | 201 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) |
201 .Times(AnyNumber()) | 202 .Times(AtMost(1)) |
202 .WillRepeatedly(Invoke(this, &DesktopProcessTest::CreateInputInjector)); | 203 .WillOnce(Invoke(this, &DesktopProcessTest::CreateInputInjector)); |
203 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) | 204 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) |
204 .Times(AnyNumber()); | 205 .Times(AtMost(1)); |
205 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) | 206 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) |
206 .Times(AnyNumber()) | 207 .Times(AtMost(1)) |
207 .WillRepeatedly(Invoke(this, &DesktopProcessTest::CreateVideoCapturer)); | 208 .WillOnce(Invoke(this, &DesktopProcessTest::CreateVideoCapturer)); |
| 209 EXPECT_CALL(*desktop_environment, GetCapabilities()) |
| 210 .Times(AtMost(1)); |
| 211 EXPECT_CALL(*desktop_environment, SetCapabilities(_)) |
| 212 .Times(AtMost(1)); |
208 | 213 |
209 // Notify the test that the desktop environment has been created. | 214 // Notify the test that the desktop environment has been created. |
210 network_listener_.OnDesktopEnvironmentCreated(); | 215 network_listener_.OnDesktopEnvironmentCreated(); |
211 return desktop_environment; | 216 return desktop_environment; |
212 } | 217 } |
213 | 218 |
214 InputInjector* DesktopProcessTest::CreateInputInjector() { | 219 InputInjector* DesktopProcessTest::CreateInputInjector() { |
215 MockInputInjector* input_injector = new MockInputInjector(); | 220 MockInputInjector* input_injector = new MockInputInjector(); |
216 EXPECT_CALL(*input_injector, StartPtr(_)); | 221 EXPECT_CALL(*input_injector, StartPtr(_)); |
217 return input_injector; | 222 return input_injector; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 342 } |
338 | 343 |
339 // Run the desktop process and ask it to crash. | 344 // Run the desktop process and ask it to crash. |
340 TEST_F(DesktopProcessTest, DeathTest) { | 345 TEST_F(DesktopProcessTest, DeathTest) { |
341 testing::GTEST_FLAG(death_test_style) = "threadsafe"; | 346 testing::GTEST_FLAG(death_test_style) = "threadsafe"; |
342 | 347 |
343 EXPECT_DEATH(RunDeathTest(), ""); | 348 EXPECT_DEATH(RunDeathTest(), ""); |
344 } | 349 } |
345 | 350 |
346 } // namespace remoting | 351 } // namespace remoting |
OLD | NEW |