| 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/renderer_host/media/web_contents_video_capture_device.
h" | 5 #include "content/browser/renderer_host/media/web_contents_video_capture_device.
h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/debug/debugger.h" | 8 #include "base/debug/debugger.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // consumer. The test will alternate between the SkBitmap and the VideoFrame | 483 // consumer. The test will alternate between the SkBitmap and the VideoFrame |
| 484 // paths, just as RenderWidgetHost might if the content falls in and out of | 484 // paths, just as RenderWidgetHost might if the content falls in and out of |
| 485 // accelerated compositing. | 485 // accelerated compositing. |
| 486 TEST_F(WebContentsVideoCaptureDeviceTest, GoesThroughAllTheMotions) { | 486 TEST_F(WebContentsVideoCaptureDeviceTest, GoesThroughAllTheMotions) { |
| 487 device()->Allocate(kTestWidth, kTestHeight, kTestFramesPerSecond, consumer()); | 487 device()->Allocate(kTestWidth, kTestHeight, kTestFramesPerSecond, consumer()); |
| 488 | 488 |
| 489 device()->Start(); | 489 device()->Start(); |
| 490 | 490 |
| 491 bool use_video_frames = false; | 491 bool use_video_frames = false; |
| 492 for (int i = 0; i < 4; i++, use_video_frames = !use_video_frames) { | 492 for (int i = 0; i < 4; i++, use_video_frames = !use_video_frames) { |
| 493 SCOPED_TRACE(StringPrintf("Using %s copy path, iteration #%d", | 493 SCOPED_TRACE(base::StringPrintf( |
| 494 use_video_frames ? "VideoFrame" : "SkBitmap", i)); | 494 "Using %s copy path, iteration #%d", |
| 495 use_video_frames ? "VideoFrame" : "SkBitmap", i)); |
| 495 source()->SetCanCopyToVideoFrame(use_video_frames); | 496 source()->SetCanCopyToVideoFrame(use_video_frames); |
| 496 source()->SetSolidColor(SK_ColorRED); | 497 source()->SetSolidColor(SK_ColorRED); |
| 497 ASSERT_NO_FATAL_FAILURE(source()->WaitForNextBackingStoreCopy()); | 498 ASSERT_NO_FATAL_FAILURE(source()->WaitForNextBackingStoreCopy()); |
| 498 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); | 499 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); |
| 499 source()->SetSolidColor(SK_ColorGREEN); | 500 source()->SetSolidColor(SK_ColorGREEN); |
| 500 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); | 501 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); |
| 501 source()->SetSolidColor(SK_ColorBLUE); | 502 source()->SetSolidColor(SK_ColorBLUE); |
| 502 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorBLUE)); | 503 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorBLUE)); |
| 503 source()->SetSolidColor(SK_ColorBLACK); | 504 source()->SetSolidColor(SK_ColorBLACK); |
| 504 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorBLACK)); | 505 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorBLACK)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 source()->SetSolidColor(SK_ColorGREEN); | 539 source()->SetSolidColor(SK_ColorGREEN); |
| 539 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); | 540 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); |
| 540 source()->SetSolidColor(SK_ColorRED); | 541 source()->SetSolidColor(SK_ColorRED); |
| 541 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); | 542 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); |
| 542 | 543 |
| 543 device()->Stop(); | 544 device()->Stop(); |
| 544 device()->DeAllocate(); | 545 device()->DeAllocate(); |
| 545 } | 546 } |
| 546 | 547 |
| 547 } // namespace content | 548 } // namespace content |
| OLD | NEW |