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 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 private: | 53 private: |
54 char* buffer_; | 54 char* buffer_; |
55 RTC_DISALLOW_COPY_AND_ASSIGN(FakeSharedMemory); | 55 RTC_DISALLOW_COPY_AND_ASSIGN(FakeSharedMemory); |
56 }; | 56 }; |
57 | 57 |
58 class FakeSharedMemoryFactory : public SharedMemoryFactory { | 58 class FakeSharedMemoryFactory : public SharedMemoryFactory { |
59 public: | 59 public: |
60 FakeSharedMemoryFactory() {} | 60 FakeSharedMemoryFactory() {} |
61 ~FakeSharedMemoryFactory() override {} | 61 ~FakeSharedMemoryFactory() override {} |
62 | 62 |
63 std::unique_ptr<SharedMemory> CreateSharedMemory(size_t size) override { | 63 rtc::scoped_ptr<SharedMemory> CreateSharedMemory(size_t size) override { |
64 return std::unique_ptr<SharedMemory>( | 64 return rtc::scoped_ptr<SharedMemory>( |
65 new FakeSharedMemory(new char[size], size)); | 65 new FakeSharedMemory(new char[size], size)); |
66 } | 66 } |
67 | 67 |
68 private: | 68 private: |
69 RTC_DISALLOW_COPY_AND_ASSIGN(FakeSharedMemoryFactory); | 69 RTC_DISALLOW_COPY_AND_ASSIGN(FakeSharedMemoryFactory); |
70 }; | 70 }; |
71 | 71 |
72 TEST_F(ScreenCapturerTest, GetScreenListAndSelectScreen) { | 72 TEST_F(ScreenCapturerTest, GetScreenListAndSelectScreen) { |
73 webrtc::ScreenCapturer::ScreenList screens; | 73 webrtc::ScreenCapturer::ScreenList screens; |
74 EXPECT_TRUE(capturer_->GetScreenList(&screens)); | 74 EXPECT_TRUE(capturer_->GetScreenList(&screens)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 #if defined(WEBRTC_WIN) | 112 #if defined(WEBRTC_WIN) |
113 | 113 |
114 TEST_F(ScreenCapturerTest, UseSharedBuffers) { | 114 TEST_F(ScreenCapturerTest, UseSharedBuffers) { |
115 DesktopFrame* frame = NULL; | 115 DesktopFrame* frame = NULL; |
116 EXPECT_CALL(callback_, OnCaptureCompleted(_)) | 116 EXPECT_CALL(callback_, OnCaptureCompleted(_)) |
117 .WillOnce(SaveArg<0>(&frame)); | 117 .WillOnce(SaveArg<0>(&frame)); |
118 | 118 |
119 capturer_->Start(&callback_); | 119 capturer_->Start(&callback_); |
120 capturer_->SetSharedMemoryFactory( | 120 capturer_->SetSharedMemoryFactory( |
121 std::unique_ptr<SharedMemoryFactory>(new FakeSharedMemoryFactory())); | 121 rtc::scoped_ptr<SharedMemoryFactory>(new FakeSharedMemoryFactory())); |
122 capturer_->Capture(DesktopRegion()); | 122 capturer_->Capture(DesktopRegion()); |
123 | 123 |
124 ASSERT_TRUE(frame); | 124 ASSERT_TRUE(frame); |
125 ASSERT_TRUE(frame->shared_memory()); | 125 ASSERT_TRUE(frame->shared_memory()); |
126 EXPECT_EQ(frame->shared_memory()->id(), kTestSharedMemoryId); | 126 EXPECT_EQ(frame->shared_memory()->id(), kTestSharedMemoryId); |
127 | 127 |
128 delete frame; | 128 delete frame; |
129 } | 129 } |
130 | 130 |
131 TEST_F(ScreenCapturerTest, UseMagnifier) { | 131 TEST_F(ScreenCapturerTest, UseMagnifier) { |
132 DesktopCaptureOptions options(DesktopCaptureOptions::CreateDefault()); | 132 DesktopCaptureOptions options(DesktopCaptureOptions::CreateDefault()); |
133 options.set_allow_use_magnification_api(true); | 133 options.set_allow_use_magnification_api(true); |
134 capturer_.reset(ScreenCapturer::Create(options)); | 134 capturer_.reset(ScreenCapturer::Create(options)); |
135 | 135 |
136 DesktopFrame* frame = NULL; | 136 DesktopFrame* frame = NULL; |
137 EXPECT_CALL(callback_, OnCaptureCompleted(_)).WillOnce(SaveArg<0>(&frame)); | 137 EXPECT_CALL(callback_, OnCaptureCompleted(_)).WillOnce(SaveArg<0>(&frame)); |
138 | 138 |
139 capturer_->Start(&callback_); | 139 capturer_->Start(&callback_); |
140 capturer_->Capture(DesktopRegion()); | 140 capturer_->Capture(DesktopRegion()); |
141 ASSERT_TRUE(frame); | 141 ASSERT_TRUE(frame); |
142 delete frame; | 142 delete frame; |
143 } | 143 } |
144 | 144 |
145 #endif // defined(WEBRTC_WIN) | 145 #endif // defined(WEBRTC_WIN) |
146 | 146 |
147 } // namespace webrtc | 147 } // namespace webrtc |
OLD | NEW |