| OLD | NEW |
| 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/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/task.h" | 6 #include "base/task.h" |
| 7 #include "remoting/base/base_mock_objects.h" | 7 #include "remoting/base/base_mock_objects.h" |
| 8 #include "remoting/host/host_mock_objects.h" | 8 #include "remoting/host/host_mock_objects.h" |
| 9 #include "remoting/host/screen_recorder.h" | 9 #include "remoting/host/screen_recorder.h" |
| 10 #include "remoting/proto/video.pb.h" | 10 #include "remoting/proto/video.pb.h" |
| 11 #include "remoting/protocol/protocol_mock_objects.h" | 11 #include "remoting/protocol/protocol_mock_objects.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 using ::remoting::protocol::MockConnectionToClient; | 15 using ::remoting::protocol::MockConnectionToClient; |
| 16 using ::remoting::protocol::MockConnectionToClientEventHandler; | 16 using ::remoting::protocol::MockConnectionToClientEventHandler; |
| 17 using ::remoting::protocol::MockHostStub; | 17 using ::remoting::protocol::MockHostStub; |
| 18 using ::remoting::protocol::MockInputStub; | |
| 19 using ::remoting::protocol::MockVideoStub; | 18 using ::remoting::protocol::MockVideoStub; |
| 20 | 19 |
| 21 using ::testing::_; | 20 using ::testing::_; |
| 22 using ::testing::AtLeast; | 21 using ::testing::AtLeast; |
| 23 using ::testing::DeleteArg; | 22 using ::testing::DeleteArg; |
| 24 using ::testing::DoAll; | 23 using ::testing::DoAll; |
| 25 using ::testing::InSequence; | 24 using ::testing::InSequence; |
| 26 using ::testing::InvokeWithoutArgs; | 25 using ::testing::InvokeWithoutArgs; |
| 27 using ::testing::NotNull; | 26 using ::testing::NotNull; |
| 28 using ::testing::Return; | 27 using ::testing::Return; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 class ScreenRecorderTest : public testing::Test { | 74 class ScreenRecorderTest : public testing::Test { |
| 76 public: | 75 public: |
| 77 ScreenRecorderTest() { | 76 ScreenRecorderTest() { |
| 78 } | 77 } |
| 79 | 78 |
| 80 virtual void SetUp() { | 79 virtual void SetUp() { |
| 81 // Capturer and Encoder are owned by ScreenRecorder. | 80 // Capturer and Encoder are owned by ScreenRecorder. |
| 82 encoder_ = new MockEncoder(); | 81 encoder_ = new MockEncoder(); |
| 83 | 82 |
| 84 connection_ = new MockConnectionToClient(&message_loop_, &handler_, | 83 connection_ = new MockConnectionToClient(&message_loop_, &handler_, |
| 85 &host_stub_, &input_stub_); | 84 &host_stub_, &event_executor_); |
| 86 | 85 |
| 87 record_ = new ScreenRecorder( | 86 record_ = new ScreenRecorder( |
| 88 &message_loop_, &message_loop_, &message_loop_, | 87 &message_loop_, &message_loop_, &message_loop_, |
| 89 &capturer_, encoder_); | 88 &capturer_, encoder_); |
| 90 } | 89 } |
| 91 | 90 |
| 92 protected: | 91 protected: |
| 93 scoped_refptr<ScreenRecorder> record_; | 92 scoped_refptr<ScreenRecorder> record_; |
| 94 | 93 |
| 95 MockConnectionToClientEventHandler handler_; | 94 MockConnectionToClientEventHandler handler_; |
| 96 MockHostStub host_stub_; | 95 MockHostStub host_stub_; |
| 97 MockInputStub input_stub_; | 96 MockEventExecutor event_executor_; |
| 98 scoped_refptr<MockConnectionToClient> connection_; | 97 scoped_refptr<MockConnectionToClient> connection_; |
| 99 | 98 |
| 100 // The following mock objects are owned by ScreenRecorder. | 99 // The following mock objects are owned by ScreenRecorder. |
| 101 MockCapturer capturer_; | 100 MockCapturer capturer_; |
| 102 MockEncoder* encoder_; | 101 MockEncoder* encoder_; |
| 103 MessageLoop message_loop_; | 102 MessageLoop message_loop_; |
| 104 private: | 103 private: |
| 105 DISALLOW_COPY_AND_ASSIGN(ScreenRecorderTest); | 104 DISALLOW_COPY_AND_ASSIGN(ScreenRecorderTest); |
| 106 }; | 105 }; |
| 107 | 106 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 record_->Start(); | 201 record_->Start(); |
| 203 message_loop_.Run(); | 202 message_loop_.Run(); |
| 204 } | 203 } |
| 205 | 204 |
| 206 TEST_F(ScreenRecorderTest, StopWithoutStart) { | 205 TEST_F(ScreenRecorderTest, StopWithoutStart) { |
| 207 record_->Stop(NewRunnableFunction(&QuitMessageLoop, &message_loop_)); | 206 record_->Stop(NewRunnableFunction(&QuitMessageLoop, &message_loop_)); |
| 208 message_loop_.Run(); | 207 message_loop_.Run(); |
| 209 } | 208 } |
| 210 | 209 |
| 211 } // namespace remoting | 210 } // namespace remoting |
| OLD | NEW |