| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/desktop_capture/fallback_desktop_capturer_wrapper.h" | 11 #include "webrtc/modules/desktop_capture/fallback_desktop_capturer_wrapper.h" |
| 12 | 12 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 protected: | 73 protected: |
| 74 std::vector<std::pair<DesktopCapturer::Result, bool>> results_; | 74 std::vector<std::pair<DesktopCapturer::Result, bool>> results_; |
| 75 FakeDesktopCapturer* main_capturer_ = nullptr; | 75 FakeDesktopCapturer* main_capturer_ = nullptr; |
| 76 FakeDesktopCapturer* secondary_capturer_ = nullptr; | 76 FakeDesktopCapturer* secondary_capturer_ = nullptr; |
| 77 std::unique_ptr<FallbackDesktopCapturerWrapper> wrapper_; | 77 std::unique_ptr<FallbackDesktopCapturerWrapper> wrapper_; |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // DesktopCapturer::Callback interface | 80 // DesktopCapturer::Callback interface |
| 81 void OnCaptureResult(DesktopCapturer::Result result, | 81 void OnCaptureResult(DesktopCapturer::Result result, |
| 82 std::unique_ptr<DesktopFrame> frame) override; | 82 std::unique_ptr<DesktopFrame> frame) override; |
| 83 PainterDesktopFrameGenerator frame_generator; | 83 PainterDesktopFrameGenerator frame_generator_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 FallbackDesktopCapturerWrapperTest::FallbackDesktopCapturerWrapperTest() { | 86 FallbackDesktopCapturerWrapperTest::FallbackDesktopCapturerWrapperTest() { |
| 87 frame_generator.size()->set(1024, 768); | 87 frame_generator_.size()->set(1024, 768); |
| 88 std::unique_ptr<DesktopCapturer> main_capturer = | 88 std::unique_ptr<DesktopCapturer> main_capturer = |
| 89 CreateDesktopCapturer(&frame_generator); | 89 CreateDesktopCapturer(&frame_generator_); |
| 90 std::unique_ptr<DesktopCapturer> secondary_capturer = | 90 std::unique_ptr<DesktopCapturer> secondary_capturer = |
| 91 CreateDesktopCapturer(&frame_generator); | 91 CreateDesktopCapturer(&frame_generator_); |
| 92 main_capturer_ = static_cast<FakeDesktopCapturer*>(main_capturer.get()); | 92 main_capturer_ = static_cast<FakeDesktopCapturer*>(main_capturer.get()); |
| 93 secondary_capturer_ = | 93 secondary_capturer_ = |
| 94 static_cast<FakeDesktopCapturer*>(secondary_capturer.get()); | 94 static_cast<FakeDesktopCapturer*>(secondary_capturer.get()); |
| 95 wrapper_.reset(new FallbackDesktopCapturerWrapper( | 95 wrapper_.reset(new FallbackDesktopCapturerWrapper( |
| 96 std::move(main_capturer), std::move(secondary_capturer))); | 96 std::move(main_capturer), std::move(secondary_capturer))); |
| 97 wrapper_->Start(this); | 97 wrapper_->Start(this); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void FallbackDesktopCapturerWrapperTest::OnCaptureResult( | 100 void FallbackDesktopCapturerWrapperTest::OnCaptureResult( |
| 101 DesktopCapturer::Result result, | 101 DesktopCapturer::Result result, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 ASSERT_EQ(secondary_capturer_->num_capture_attempts(), 3); | 196 ASSERT_EQ(secondary_capturer_->num_capture_attempts(), 3); |
| 197 ASSERT_EQ(secondary_capturer_->num_frames_captured(), 3); | 197 ASSERT_EQ(secondary_capturer_->num_frames_captured(), 3); |
| 198 ASSERT_EQ(results_.size(), 5U); | 198 ASSERT_EQ(results_.size(), 5U); |
| 199 for (int i = 0; i < 5; i++) { | 199 for (int i = 0; i < 5; i++) { |
| 200 ASSERT_EQ(results_[i], | 200 ASSERT_EQ(results_[i], |
| 201 std::make_pair(DesktopCapturer::Result::SUCCESS, true)); | 201 std::make_pair(DesktopCapturer::Result::SUCCESS, true)); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace webrtc | 205 } // namespace webrtc |
| OLD | NEW |