| 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 <ApplicationServices/ApplicationServices.h> | 11 #include <ApplicationServices/ApplicationServices.h> |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 #include <ostream> | 14 #include <ostream> |
| 15 | 15 |
| 16 #include "webrtc/modules/desktop_capture/desktop_capturer.h" | 16 #include "webrtc/modules/desktop_capture/desktop_capturer.h" |
| 17 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 17 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 18 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 18 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
| 19 #include "webrtc/modules/desktop_capture/desktop_geometry.h" | 19 #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
| 20 #include "webrtc/modules/desktop_capture/desktop_region.h" | 20 #include "webrtc/modules/desktop_capture/desktop_region.h" |
| 21 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" | 21 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" |
| 22 #include "webrtc/modules/desktop_capture/screen_capturer_mock_objects.h" | 22 #include "webrtc/modules/desktop_capture/mock_desktop_capturer_callback.h" |
| 23 #include "webrtc/test/gtest.h" | 23 #include "webrtc/test/gtest.h" |
| 24 | 24 |
| 25 using ::testing::_; | 25 using ::testing::_; |
| 26 using ::testing::AnyNumber; | 26 using ::testing::AnyNumber; |
| 27 using ::testing::Return; | 27 using ::testing::Return; |
| 28 | 28 |
| 29 namespace webrtc { | 29 namespace webrtc { |
| 30 | 30 |
| 31 class ScreenCapturerMacTest : public testing::Test { | 31 class ScreenCapturerMacTest : public testing::Test { |
| 32 public: | 32 public: |
| 33 // Verifies that the whole screen is initially dirty. | 33 // Verifies that the whole screen is initially dirty. |
| 34 void CaptureDoneCallback1(DesktopCapturer::Result result, | 34 void CaptureDoneCallback1(DesktopCapturer::Result result, |
| 35 std::unique_ptr<DesktopFrame>* frame); | 35 std::unique_ptr<DesktopFrame>* frame); |
| 36 | 36 |
| 37 // Verifies that a rectangle explicitly marked as dirty is propagated | 37 // Verifies that a rectangle explicitly marked as dirty is propagated |
| 38 // correctly. | 38 // correctly. |
| 39 void CaptureDoneCallback2(DesktopCapturer::Result result, | 39 void CaptureDoneCallback2(DesktopCapturer::Result result, |
| 40 std::unique_ptr<DesktopFrame>* frame); | 40 std::unique_ptr<DesktopFrame>* frame); |
| 41 | 41 |
| 42 protected: | 42 protected: |
| 43 void SetUp() override { | 43 void SetUp() override { |
| 44 capturer_ = DesktopCapturer::CreateScreenCapturer( | 44 capturer_ = DesktopCapturer::CreateScreenCapturer( |
| 45 DesktopCaptureOptions::CreateDefault()); | 45 DesktopCaptureOptions::CreateDefault()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 std::unique_ptr<DesktopCapturer> capturer_; | 48 std::unique_ptr<DesktopCapturer> capturer_; |
| 49 MockScreenCapturerCallback callback_; | 49 MockDesktopCapturerCallback callback_; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 void ScreenCapturerMacTest::CaptureDoneCallback1( | 52 void ScreenCapturerMacTest::CaptureDoneCallback1( |
| 53 DesktopCapturer::Result result, | 53 DesktopCapturer::Result result, |
| 54 std::unique_ptr<DesktopFrame>* frame) { | 54 std::unique_ptr<DesktopFrame>* frame) { |
| 55 EXPECT_EQ(result, DesktopCapturer::Result::SUCCESS); | 55 EXPECT_EQ(result, DesktopCapturer::Result::SUCCESS); |
| 56 | 56 |
| 57 MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent( | 57 MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent( |
| 58 MacDesktopConfiguration::BottomLeftOrigin); | 58 MacDesktopConfiguration::BottomLeftOrigin); |
| 59 | 59 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 capturer_->Start(&callback_); | 92 capturer_->Start(&callback_); |
| 93 | 93 |
| 94 // Check that we get an initial full-screen updated. | 94 // Check that we get an initial full-screen updated. |
| 95 capturer_->CaptureFrame(); | 95 capturer_->CaptureFrame(); |
| 96 | 96 |
| 97 // Check that subsequent dirty rects are propagated correctly. | 97 // Check that subsequent dirty rects are propagated correctly. |
| 98 capturer_->CaptureFrame(); | 98 capturer_->CaptureFrame(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace webrtc | 101 } // namespace webrtc |
| OLD | NEW |