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 "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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 : error_encountered_(false), | 395 : error_encountered_(false), |
396 wait_color_yuv_(0xcafe1950) { | 396 wait_color_yuv_(0xcafe1950) { |
397 client_.reset(new StubClient( | 397 client_.reset(new StubClient( |
398 base::Bind(&StubClientObserver::OnColor, base::Unretained(this)), | 398 base::Bind(&StubClientObserver::OnColor, base::Unretained(this)), |
399 base::Bind(&StubClientObserver::OnError, base::Unretained(this)))); | 399 base::Bind(&StubClientObserver::OnError, base::Unretained(this)))); |
400 } | 400 } |
401 | 401 |
402 virtual ~StubClientObserver() {} | 402 virtual ~StubClientObserver() {} |
403 | 403 |
404 scoped_ptr<media::VideoCaptureDevice::Client> PassClient() { | 404 scoped_ptr<media::VideoCaptureDevice::Client> PassClient() { |
405 return client_.PassAs<media::VideoCaptureDevice::Client>(); | 405 return client_.Pass(); |
406 } | 406 } |
407 | 407 |
408 void QuitIfConditionMet(SkColor color) { | 408 void QuitIfConditionMet(SkColor color) { |
409 base::AutoLock guard(lock_); | 409 base::AutoLock guard(lock_); |
410 if (wait_color_yuv_ == color || error_encountered_) | 410 if (wait_color_yuv_ == color || error_encountered_) |
411 base::MessageLoop::current()->Quit(); | 411 base::MessageLoop::current()->Quit(); |
412 } | 412 } |
413 | 413 |
414 void WaitForNextColor(SkColor expected_color) { | 414 void WaitForNextColor(SkColor expected_color) { |
415 { | 415 { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 source()->SetSolidColor(SK_ColorGREEN); | 855 source()->SetSolidColor(SK_ColorGREEN); |
856 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 856 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
857 source()->SetSolidColor(SK_ColorRED); | 857 source()->SetSolidColor(SK_ColorRED); |
858 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); | 858 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); |
859 | 859 |
860 device()->StopAndDeAllocate(); | 860 device()->StopAndDeAllocate(); |
861 } | 861 } |
862 | 862 |
863 } // namespace | 863 } // namespace |
864 } // namespace content | 864 } // namespace content |
OLD | NEW |