OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/screen_recorder.h" | 5 #include "remoting/host/screen_recorder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "remoting/base/base_mock_objects.h" | 9 #include "remoting/base/base_mock_objects.h" |
10 #include "remoting/host/host_mock_objects.h" | 10 #include "remoting/host/host_mock_objects.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // ScreenRecorder is instructed to come to a complete stop. We expect the stop | 120 // ScreenRecorder is instructed to come to a complete stop. We expect the stop |
121 // sequence to be executed successfully. | 121 // sequence to be executed successfully. |
122 TEST_F(ScreenRecorderTest, StartAndStop) { | 122 TEST_F(ScreenRecorderTest, StartAndStop) { |
123 SkRegion update_region(SkIRect::MakeXYWH(0, 0, 10, 10)); | 123 SkRegion update_region(SkIRect::MakeXYWH(0, 0, 10, 10)); |
124 DataPlanes planes; | 124 DataPlanes planes; |
125 for (int i = 0; i < DataPlanes::kPlaneCount; ++i) { | 125 for (int i = 0; i < DataPlanes::kPlaneCount; ++i) { |
126 planes.data[i] = reinterpret_cast<uint8*>(i); | 126 planes.data[i] = reinterpret_cast<uint8*>(i); |
127 planes.strides[i] = kWidth * 4; | 127 planes.strides[i] = kWidth * 4; |
128 } | 128 } |
129 | 129 |
130 Expectation capturer_start = EXPECT_CALL(capturer_, Start()); | 130 Expectation capturer_start = EXPECT_CALL(capturer_, Start(_)); |
131 | 131 |
132 SkISize size(SkISize::Make(kWidth, kHeight)); | 132 SkISize size(SkISize::Make(kWidth, kHeight)); |
133 scoped_refptr<CaptureData> data(new CaptureData(planes, size, kFormat)); | 133 scoped_refptr<CaptureData> data(new CaptureData(planes, size, kFormat)); |
134 EXPECT_CALL(capturer_, InvalidateFullScreen()); | 134 EXPECT_CALL(capturer_, InvalidateFullScreen()); |
135 | 135 |
136 // First the capturer is called. | 136 // First the capturer is called. |
137 Expectation capturer_capture = EXPECT_CALL(capturer_, CaptureInvalidRegion(_)) | 137 Expectation capturer_capture = EXPECT_CALL(capturer_, CaptureInvalidRegion(_)) |
138 .After(capturer_start) | 138 .After(capturer_start) |
139 .WillRepeatedly(RunCallback(update_region, data)); | 139 .WillRepeatedly(RunCallback(update_region, data)); |
140 | 140 |
(...skipping 28 matching lines...) Expand all Loading... |
169 record_->Start(); | 169 record_->Start(); |
170 message_loop_.Run(); | 170 message_loop_.Run(); |
171 } | 171 } |
172 | 172 |
173 TEST_F(ScreenRecorderTest, StopWithoutStart) { | 173 TEST_F(ScreenRecorderTest, StopWithoutStart) { |
174 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); | 174 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); |
175 message_loop_.Run(); | 175 message_loop_.Run(); |
176 } | 176 } |
177 | 177 |
178 } // namespace remoting | 178 } // namespace remoting |
OLD | NEW |