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 "content/browser/media/capture/web_contents_video_capture_device.h" | 5 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 | 1227 |
1228 // Suspend capture and then draw a GREEN frame. No frame capture should | 1228 // Suspend capture and then draw a GREEN frame. No frame capture should |
1229 // occur. | 1229 // occur. |
1230 device()->MaybeSuspend(); | 1230 device()->MaybeSuspend(); |
1231 base::RunLoop().RunUntilIdle(); | 1231 base::RunLoop().RunUntilIdle(); |
1232 client_observer()->SetIsExpectingFrames(false); | 1232 client_observer()->SetIsExpectingFrames(false); |
1233 source()->SetSolidColor(SK_ColorGREEN); | 1233 source()->SetSolidColor(SK_ColorGREEN); |
1234 SimulateDrawEvent(); | 1234 SimulateDrawEvent(); |
1235 base::RunLoop().RunUntilIdle(); | 1235 base::RunLoop().RunUntilIdle(); |
1236 | 1236 |
1237 // Resume capture and then draw a BLUE frame and wait for it to be captured. | 1237 // Resume capture and expect a GREEN update frame to be captured. |
| 1238 client_observer()->SetIsExpectingFrames(true); |
1238 device()->Resume(); | 1239 device()->Resume(); |
1239 base::RunLoop().RunUntilIdle(); | 1240 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
1240 client_observer()->SetIsExpectingFrames(true); | 1241 |
| 1242 // Draw a BLUE frame and wait for it to be captured. |
1241 source()->SetSolidColor(SK_ColorBLUE); | 1243 source()->SetSolidColor(SK_ColorBLUE); |
1242 SimulateDrawEvent(); | 1244 SimulateDrawEvent(); |
1243 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorBLUE)); | 1245 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorBLUE)); |
1244 } | 1246 } |
1245 | 1247 |
1246 device()->StopAndDeAllocate(); | 1248 device()->StopAndDeAllocate(); |
1247 } | 1249 } |
1248 | 1250 |
1249 // Tests the RequestRefreshFrame() functionality. | 1251 // Tests the RequestRefreshFrame() functionality. |
1250 TEST_F(MAYBE_WebContentsVideoCaptureDeviceTest, ProvidesRefreshFrames) { | 1252 TEST_F(MAYBE_WebContentsVideoCaptureDeviceTest, ProvidesRefreshFrames) { |
(...skipping 21 matching lines...) Expand all Loading... |
1272 for (int i = 0; i < 3; ++i) { | 1274 for (int i = 0; i < 3; ++i) { |
1273 SimulateRefreshFrameRequest(); | 1275 SimulateRefreshFrameRequest(); |
1274 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 1276 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
1275 } | 1277 } |
1276 | 1278 |
1277 device()->StopAndDeAllocate(); | 1279 device()->StopAndDeAllocate(); |
1278 } | 1280 } |
1279 | 1281 |
1280 } // namespace | 1282 } // namespace |
1281 } // namespace content | 1283 } // namespace content |
OLD | NEW |