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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 std::unique_ptr<DesktopFrame>* frame) { | 67 std::unique_ptr<DesktopFrame>* frame) { |
68 EXPECT_EQ(result, DesktopCapturer::Result::SUCCESS); | 68 EXPECT_EQ(result, DesktopCapturer::Result::SUCCESS); |
69 | 69 |
70 MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent( | 70 MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent( |
71 MacDesktopConfiguration::BottomLeftOrigin); | 71 MacDesktopConfiguration::BottomLeftOrigin); |
72 int width = config.pixel_bounds.width(); | 72 int width = config.pixel_bounds.width(); |
73 int height = config.pixel_bounds.height(); | 73 int height = config.pixel_bounds.height(); |
74 | 74 |
75 EXPECT_EQ(width, (*frame)->size().width()); | 75 EXPECT_EQ(width, (*frame)->size().width()); |
76 EXPECT_EQ(height, (*frame)->size().height()); | 76 EXPECT_EQ(height, (*frame)->size().height()); |
77 EXPECT_TRUE((*frame)->data() != NULL); | 77 EXPECT_TRUE((*frame)->data() != nullptr); |
78 // Depending on the capture method, the screen may be flipped or not, so | 78 // Depending on the capture method, the screen may be flipped or not, so |
79 // the stride may be positive or negative. | 79 // the stride may be positive or negative. |
80 EXPECT_EQ(static_cast<int>(sizeof(uint32_t) * width), | 80 EXPECT_EQ(static_cast<int>(sizeof(uint32_t) * width), |
81 abs((*frame)->stride())); | 81 abs((*frame)->stride())); |
82 } | 82 } |
83 | 83 |
84 TEST_F(ScreenCapturerMacTest, Capture) { | 84 TEST_F(ScreenCapturerMacTest, Capture) { |
85 EXPECT_CALL(callback_, | 85 EXPECT_CALL(callback_, |
86 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _)) | 86 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _)) |
87 .Times(2) | 87 .Times(2) |
88 .WillOnce(Invoke(this, &ScreenCapturerMacTest::CaptureDoneCallback1)) | 88 .WillOnce(Invoke(this, &ScreenCapturerMacTest::CaptureDoneCallback1)) |
89 .WillOnce(Invoke(this, &ScreenCapturerMacTest::CaptureDoneCallback2)); | 89 .WillOnce(Invoke(this, &ScreenCapturerMacTest::CaptureDoneCallback2)); |
90 | 90 |
91 SCOPED_TRACE(""); | 91 SCOPED_TRACE(""); |
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 |