| 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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 | 1005 |
| 1006 // Suspend capture and then draw a GREEN frame. No frame capture should | 1006 // Suspend capture and then draw a GREEN frame. No frame capture should |
| 1007 // occur. | 1007 // occur. |
| 1008 device()->MaybeSuspend(); | 1008 device()->MaybeSuspend(); |
| 1009 base::RunLoop().RunUntilIdle(); | 1009 base::RunLoop().RunUntilIdle(); |
| 1010 client_observer()->SetIsExpectingFrames(false); | 1010 client_observer()->SetIsExpectingFrames(false); |
| 1011 test_view()->SetSolidColor(SK_ColorGREEN); | 1011 test_view()->SetSolidColor(SK_ColorGREEN); |
| 1012 SimulateDrawEvent(); | 1012 SimulateDrawEvent(); |
| 1013 base::RunLoop().RunUntilIdle(); | 1013 base::RunLoop().RunUntilIdle(); |
| 1014 | 1014 |
| 1015 // Resume capture and then draw a BLUE frame and wait for it to be captured. | 1015 // Resume capture and expect a GREEN update frame to be captured. |
| 1016 client_observer()->SetIsExpectingFrames(true); |
| 1016 device()->Resume(); | 1017 device()->Resume(); |
| 1017 base::RunLoop().RunUntilIdle(); | 1018 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
| 1018 client_observer()->SetIsExpectingFrames(true); | 1019 |
| 1020 // Draw a BLUE frame and wait for it to be captured. |
| 1019 test_view()->SetSolidColor(SK_ColorBLUE); | 1021 test_view()->SetSolidColor(SK_ColorBLUE); |
| 1020 SimulateDrawEvent(); | 1022 SimulateDrawEvent(); |
| 1021 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorBLUE)); | 1023 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorBLUE)); |
| 1022 } | 1024 } |
| 1023 | 1025 |
| 1024 device()->StopAndDeAllocate(); | 1026 device()->StopAndDeAllocate(); |
| 1025 } | 1027 } |
| 1026 | 1028 |
| 1027 // Tests the RequestRefreshFrame() functionality. | 1029 // Tests the RequestRefreshFrame() functionality. |
| 1028 TEST_F(WebContentsVideoCaptureDeviceTest, ProvidesRefreshFrames) { | 1030 TEST_F(WebContentsVideoCaptureDeviceTest, ProvidesRefreshFrames) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1047 for (int i = 0; i < 3; ++i) { | 1049 for (int i = 0; i < 3; ++i) { |
| 1048 SimulateRefreshFrameRequest(); | 1050 SimulateRefreshFrameRequest(); |
| 1049 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 1051 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 device()->StopAndDeAllocate(); | 1054 device()->StopAndDeAllocate(); |
| 1053 } | 1055 } |
| 1054 | 1056 |
| 1055 } // namespace | 1057 } // namespace |
| 1056 } // namespace content | 1058 } // namespace content |
| OLD | NEW |