| 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/video_scheduler.h" | 5 #include "remoting/host/video_scheduler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "remoting/base/auto_thread.h" | 11 #include "remoting/base/auto_thread.h" |
| 12 #include "remoting/base/auto_thread_task_runner.h" | 12 #include "remoting/base/auto_thread_task_runner.h" |
| 13 #include "remoting/codec/video_encoder_verbatim.h" | 13 #include "remoting/codec/video_encoder_verbatim.h" |
| 14 #include "remoting/host/screen_capturer_fake.h" | 14 #include "remoting/host/fake_screen_capturer.h" |
| 15 #include "remoting/proto/video.pb.h" | 15 #include "remoting/proto/video.pb.h" |
| 16 #include "remoting/protocol/protocol_mock_objects.h" | 16 #include "remoting/protocol/protocol_mock_objects.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 19 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| 20 #include "third_party/webrtc/modules/desktop_capture/screen_capturer_mock_object
s.h" | 20 #include "third_party/webrtc/modules/desktop_capture/screen_capturer_mock_object
s.h" |
| 21 | 21 |
| 22 using ::remoting::protocol::MockClientStub; | 22 using ::remoting::protocol::MockClientStub; |
| 23 using ::remoting::protocol::MockVideoStub; | 23 using ::remoting::protocol::MockVideoStub; |
| 24 | 24 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 virtual ~ThreadCheckVideoEncoder() { | 76 virtual ~ThreadCheckVideoEncoder() { |
| 77 EXPECT_TRUE(task_runner_->BelongsToCurrentThread()); | 77 EXPECT_TRUE(task_runner_->BelongsToCurrentThread()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 81 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(ThreadCheckVideoEncoder); | 83 DISALLOW_COPY_AND_ASSIGN(ThreadCheckVideoEncoder); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 class ThreadCheckScreenCapturer : public ScreenCapturerFake { | 86 class ThreadCheckScreenCapturer : public FakeScreenCapturer { |
| 87 public: | 87 public: |
| 88 ThreadCheckScreenCapturer( | 88 ThreadCheckScreenCapturer( |
| 89 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 89 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 90 : task_runner_(task_runner) { | 90 : task_runner_(task_runner) { |
| 91 } | 91 } |
| 92 virtual ~ThreadCheckScreenCapturer() { | 92 virtual ~ThreadCheckScreenCapturer() { |
| 93 EXPECT_TRUE(task_runner_->BelongsToCurrentThread()); | 93 EXPECT_TRUE(task_runner_->BelongsToCurrentThread()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 private: | 96 private: |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 scoped_ptr<VideoEncoder> encoder( | 240 scoped_ptr<VideoEncoder> encoder( |
| 241 new ThreadCheckVideoEncoder(encode_task_runner_)); | 241 new ThreadCheckVideoEncoder(encode_task_runner_)); |
| 242 | 242 |
| 243 // Start and stop the scheduler, so it will tear down the screen capturer and | 243 // Start and stop the scheduler, so it will tear down the screen capturer and |
| 244 // video encoder. | 244 // video encoder. |
| 245 StartVideoScheduler(capturer.Pass(), encoder.Pass()); | 245 StartVideoScheduler(capturer.Pass(), encoder.Pass()); |
| 246 StopVideoScheduler(); | 246 StopVideoScheduler(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace remoting | 249 } // namespace remoting |
| OLD | NEW |