| 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 <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "webrtc/base/constructormagic.h" | 13 #include "webrtc/base/constructormagic.h" |
| 14 #include "webrtc/base/logging.h" | 14 #include "webrtc/base/logging.h" |
| 15 #include "webrtc/modules/desktop_capture/desktop_capturer.h" | 15 #include "webrtc/modules/desktop_capture/desktop_capturer.h" |
| 16 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 16 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 17 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 17 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
| 18 #include "webrtc/modules/desktop_capture/desktop_region.h" | 18 #include "webrtc/modules/desktop_capture/desktop_region.h" |
| 19 #include "webrtc/modules/desktop_capture/screen_capturer_mock_objects.h" | 19 #include "webrtc/modules/desktop_capture/mock_desktop_capturer_callback.h" |
| 20 #include "webrtc/test/gmock.h" | 20 #include "webrtc/test/gmock.h" |
| 21 #include "webrtc/test/gtest.h" | 21 #include "webrtc/test/gtest.h" |
| 22 | 22 |
| 23 #if defined(WEBRTC_WIN) | 23 #if defined(WEBRTC_WIN) |
| 24 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" | 24 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" |
| 25 #endif // defined(WEBRTC_WIN) | 25 #endif // defined(WEBRTC_WIN) |
| 26 | 26 |
| 27 using ::testing::_; | 27 using ::testing::_; |
| 28 | 28 |
| 29 const int kTestSharedMemoryId = 123; | 29 const int kTestSharedMemoryId = 123; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void CreateMagnifierCapturer() { | 61 void CreateMagnifierCapturer() { |
| 62 DesktopCaptureOptions options(DesktopCaptureOptions::CreateDefault()); | 62 DesktopCaptureOptions options(DesktopCaptureOptions::CreateDefault()); |
| 63 options.set_allow_use_magnification_api(true); | 63 options.set_allow_use_magnification_api(true); |
| 64 capturer_ = DesktopCapturer::CreateScreenCapturer(options); | 64 capturer_ = DesktopCapturer::CreateScreenCapturer(options); |
| 65 } | 65 } |
| 66 #endif // defined(WEBRTC_WIN) | 66 #endif // defined(WEBRTC_WIN) |
| 67 | 67 |
| 68 std::unique_ptr<DesktopCapturer> capturer_; | 68 std::unique_ptr<DesktopCapturer> capturer_; |
| 69 MockScreenCapturerCallback callback_; | 69 MockDesktopCapturerCallback callback_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class FakeSharedMemory : public SharedMemory { | 72 class FakeSharedMemory : public SharedMemory { |
| 73 public: | 73 public: |
| 74 FakeSharedMemory(char* buffer, size_t size) | 74 FakeSharedMemory(char* buffer, size_t size) |
| 75 : SharedMemory(buffer, size, 0, kTestSharedMemoryId), | 75 : SharedMemory(buffer, size, 0, kTestSharedMemoryId), |
| 76 buffer_(buffer) { | 76 buffer_(buffer) { |
| 77 } | 77 } |
| 78 virtual ~FakeSharedMemory() { | 78 virtual ~FakeSharedMemory() { |
| 79 delete[] buffer_; | 79 delete[] buffer_; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 std::unique_ptr<SharedMemoryFactory>(new FakeSharedMemoryFactory())); | 199 std::unique_ptr<SharedMemoryFactory>(new FakeSharedMemoryFactory())); |
| 200 capturer_->CaptureFrame(); | 200 capturer_->CaptureFrame(); |
| 201 ASSERT_TRUE(frame); | 201 ASSERT_TRUE(frame); |
| 202 ASSERT_TRUE(frame->shared_memory()); | 202 ASSERT_TRUE(frame->shared_memory()); |
| 203 EXPECT_EQ(frame->shared_memory()->id(), kTestSharedMemoryId); | 203 EXPECT_EQ(frame->shared_memory()->id(), kTestSharedMemoryId); |
| 204 } | 204 } |
| 205 | 205 |
| 206 #endif // defined(WEBRTC_WIN) | 206 #endif // defined(WEBRTC_WIN) |
| 207 | 207 |
| 208 } // namespace webrtc | 208 } // namespace webrtc |
| OLD | NEW |