| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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/screen_capturer.h" | 11 #include "webrtc/modules/desktop_capture/screen_capturer.h" |
| 12 | 12 |
| 13 #include <ApplicationServices/ApplicationServices.h> | 13 #include <ApplicationServices/ApplicationServices.h> |
| 14 | 14 |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <ostream> | 16 #include <ostream> |
| 17 | 17 |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 19 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 20 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
| 20 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | 21 #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
| 21 #include "webrtc/modules/desktop_capture/desktop_region.h" | 22 #include "webrtc/modules/desktop_capture/desktop_region.h" |
| 22 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" | 23 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" |
| 23 #include "webrtc/modules/desktop_capture/screen_capturer_mock_objects.h" | 24 #include "webrtc/modules/desktop_capture/screen_capturer_mock_objects.h" |
| 24 | 25 |
| 25 using ::testing::_; | 26 using ::testing::_; |
| 26 using ::testing::AnyNumber; | 27 using ::testing::AnyNumber; |
| 27 using ::testing::Return; | 28 using ::testing::Return; |
| 28 | 29 |
| 29 namespace webrtc { | 30 namespace webrtc { |
| 30 | 31 |
| 31 class ScreenCapturerMacTest : public testing::Test { | 32 class ScreenCapturerMacTest : public testing::Test { |
| 32 public: | 33 public: |
| 33 // Verifies that the whole screen is initially dirty. | 34 // Verifies that the whole screen is initially dirty. |
| 34 void CaptureDoneCallback1(DesktopFrame* frame); | 35 void CaptureDoneCallback1(DesktopFrame* frame); |
| 35 | 36 |
| 36 // Verifies that a rectangle explicitly marked as dirty is propagated | 37 // Verifies that a rectangle explicitly marked as dirty is propagated |
| 37 // correctly. | 38 // correctly. |
| 38 void CaptureDoneCallback2(DesktopFrame* frame); | 39 void CaptureDoneCallback2(DesktopFrame* frame); |
| 39 | 40 |
| 40 protected: | 41 protected: |
| 41 void SetUp() override { capturer_.reset(ScreenCapturer::Create()); } | 42 void SetUp() override { |
| 43 capturer_.reset( |
| 44 ScreenCapturer::Create(DesktopCaptureOptions::CreateDefault())); |
| 45 } |
| 42 | 46 |
| 43 std::unique_ptr<ScreenCapturer> capturer_; | 47 std::unique_ptr<ScreenCapturer> capturer_; |
| 44 MockScreenCapturerCallback callback_; | 48 MockScreenCapturerCallback callback_; |
| 45 }; | 49 }; |
| 46 | 50 |
| 47 void ScreenCapturerMacTest::CaptureDoneCallback1( | 51 void ScreenCapturerMacTest::CaptureDoneCallback1( |
| 48 DesktopFrame* frame) { | 52 DesktopFrame* frame) { |
| 49 std::unique_ptr<DesktopFrame> owned_frame(frame); | 53 std::unique_ptr<DesktopFrame> owned_frame(frame); |
| 50 | 54 |
| 51 MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent( | 55 MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 capturer_->Start(&callback_); | 88 capturer_->Start(&callback_); |
| 85 | 89 |
| 86 // Check that we get an initial full-screen updated. | 90 // Check that we get an initial full-screen updated. |
| 87 capturer_->Capture(DesktopRegion()); | 91 capturer_->Capture(DesktopRegion()); |
| 88 | 92 |
| 89 // Check that subsequent dirty rects are propagated correctly. | 93 // Check that subsequent dirty rects are propagated correctly. |
| 90 capturer_->Capture(DesktopRegion()); | 94 capturer_->Capture(DesktopRegion()); |
| 91 } | 95 } |
| 92 | 96 |
| 93 } // namespace webrtc | 97 } // namespace webrtc |
| OLD | NEW |