Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc

Issue 22935009: Add content::SurfaceCapturer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_stride
Patch Set: cff149b4 WIP Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory); 303 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHostFactory);
304 }; 304 };
305 305
306 // A stub consumer of captured video frames, which checks the output of 306 // A stub consumer of captured video frames, which checks the output of
307 // WebContentsVideoCaptureDevice. 307 // WebContentsVideoCaptureDevice.
308 class StubConsumer : public media::VideoCaptureDevice::EventHandler { 308 class StubConsumer : public media::VideoCaptureDevice::EventHandler {
309 public: 309 public:
310 StubConsumer() 310 StubConsumer()
311 : error_encountered_(false), 311 : error_encountered_(false),
312 wait_color_yuv_(0xcafe1950) { 312 wait_color_yuv_(0xcafe1950) {
313 buffer_pool_ = 313 buffer_pool_ = new VideoCaptureBufferPool(
314 new VideoCaptureBufferPool(kTestWidth * kTestHeight * 3 / 2, 2); 314 media::VideoFrame::AllocationSize(media::VideoFrame::I420,
315 gfx::Size(kTestWidth, kTestHeight),
316 2);
315 EXPECT_TRUE(buffer_pool_->Allocate()); 317 EXPECT_TRUE(buffer_pool_->Allocate());
316 } 318 }
317 virtual ~StubConsumer() {} 319 virtual ~StubConsumer() {}
318 320
319 void QuitIfConditionMet(SkColor color) { 321 void QuitIfConditionMet(SkColor color) {
320 base::AutoLock guard(lock_); 322 base::AutoLock guard(lock_);
321 323
322 if (wait_color_yuv_ == color || error_encountered_) 324 if (wait_color_yuv_ == color || error_encountered_)
323 base::MessageLoop::current()->Quit(); 325 base::MessageLoop::current()->Quit();
324 } 326 }
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); 799 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN));
798 source()->SetSolidColor(SK_ColorRED); 800 source()->SetSolidColor(SK_ColorRED);
799 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); 801 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED));
800 802
801 device()->Stop(); 803 device()->Stop();
802 device()->DeAllocate(); 804 device()->DeAllocate();
803 } 805 }
804 806
805 } // namespace 807 } // namespace
806 } // namespace content 808 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698