| 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/screen_recorder.h" | 5 #include "remoting/host/screen_recorder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "remoting/base/base_mock_objects.h" | 9 #include "remoting/base/base_mock_objects.h" |
| 10 #include "remoting/host/host_mock_objects.h" | 10 #include "remoting/host/host_mock_objects.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 session_ = new MockSession(); | 79 session_ = new MockSession(); |
| 80 EXPECT_CALL(*session_, SetStateChangeCallback(_)); | 80 EXPECT_CALL(*session_, SetStateChangeCallback(_)); |
| 81 EXPECT_CALL(*session_, SetRouteChangeCallback(_)); | 81 EXPECT_CALL(*session_, SetRouteChangeCallback(_)); |
| 82 EXPECT_CALL(*session_, Close()) | 82 EXPECT_CALL(*session_, Close()) |
| 83 .Times(AnyNumber()); | 83 .Times(AnyNumber()); |
| 84 connection_.reset(new MockConnectionToClient( | 84 connection_.reset(new MockConnectionToClient( |
| 85 session_, &host_stub_, &event_executor_)); | 85 session_, &host_stub_, &event_executor_)); |
| 86 connection_->SetEventHandler(&handler_); | 86 connection_->SetEventHandler(&handler_); |
| 87 | 87 |
| 88 record_ = new ScreenRecorder( | 88 record_ = new ScreenRecorder( |
| 89 &message_loop_, &message_loop_, | 89 message_loop_.message_loop_proxy(), message_loop_.message_loop_proxy(), |
| 90 base::MessageLoopProxy::current(), | 90 message_loop_.message_loop_proxy(), &capturer_, encoder_); |
| 91 &capturer_, encoder_); | |
| 92 } | 91 } |
| 93 | 92 |
| 94 virtual void TearDown() OVERRIDE { | 93 virtual void TearDown() OVERRIDE { |
| 95 connection_.reset(); | 94 connection_.reset(); |
| 96 // Run message loop before destroying because protocol::Session is | 95 // Run message loop before destroying because protocol::Session is |
| 97 // destroyed asynchronously. | 96 // destroyed asynchronously. |
| 98 message_loop_.RunAllPending(); | 97 message_loop_.RunAllPending(); |
| 99 } | 98 } |
| 100 | 99 |
| 101 protected: | 100 protected: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 message_loop_.Run(); | 170 message_loop_.Run(); |
| 172 } | 171 } |
| 173 | 172 |
| 174 TEST_F(ScreenRecorderTest, StopWithoutStart) { | 173 TEST_F(ScreenRecorderTest, StopWithoutStart) { |
| 175 EXPECT_CALL(capturer_, Stop()); | 174 EXPECT_CALL(capturer_, Stop()); |
| 176 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); | 175 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); |
| 177 message_loop_.Run(); | 176 message_loop_.Run(); |
| 178 } | 177 } |
| 179 | 178 |
| 180 } // namespace remoting | 179 } // namespace remoting |
| OLD | NEW |