| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "media/video/capture/fake_video_capture_device.h" | 10 #include "media/video/capture/fake_video_capture_device.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 FakeVideoCaptureDeviceTest() | 77 FakeVideoCaptureDeviceTest() |
| 78 : loop_(new base::MessageLoop()), | 78 : loop_(new base::MessageLoop()), |
| 79 client_(new MockClient( | 79 client_(new MockClient( |
| 80 base::Bind(&FakeVideoCaptureDeviceTest::OnFrameCaptured, | 80 base::Bind(&FakeVideoCaptureDeviceTest::OnFrameCaptured, |
| 81 base::Unretained(this)))), | 81 base::Unretained(this)))), |
| 82 video_capture_device_factory_(new FakeVideoCaptureDeviceFactory()) { | 82 video_capture_device_factory_(new FakeVideoCaptureDeviceFactory()) { |
| 83 device_enumeration_listener_ = new DeviceEnumerationListener(); | 83 device_enumeration_listener_ = new DeviceEnumerationListener(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 virtual void SetUp() { | 86 void SetUp() override {} |
| 87 } | |
| 88 | 87 |
| 89 void OnFrameCaptured(const VideoCaptureFormat& format) { | 88 void OnFrameCaptured(const VideoCaptureFormat& format) { |
| 90 last_format_ = format; | 89 last_format_ = format; |
| 91 run_loop_->QuitClosure().Run(); | 90 run_loop_->QuitClosure().Run(); |
| 92 } | 91 } |
| 93 | 92 |
| 94 void WaitForCapturedFrame() { | 93 void WaitForCapturedFrame() { |
| 95 run_loop_.reset(new base::RunLoop()); | 94 run_loop_.reset(new base::RunLoop()); |
| 96 run_loop_->Run(); | 95 run_loop_->Run(); |
| 97 } | 96 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 199 |
| 201 // We set TimeWait to 200 action timeouts and this should be enough for at | 200 // We set TimeWait to 200 action timeouts and this should be enough for at |
| 202 // least action_count/kFakeCaptureCapabilityChangePeriod calls. | 201 // least action_count/kFakeCaptureCapabilityChangePeriod calls. |
| 203 for (int i = 0; i < action_count; ++i) { | 202 for (int i = 0; i < action_count; ++i) { |
| 204 WaitForCapturedFrame(); | 203 WaitForCapturedFrame(); |
| 205 } | 204 } |
| 206 device->StopAndDeAllocate(); | 205 device->StopAndDeAllocate(); |
| 207 } | 206 } |
| 208 | 207 |
| 209 }; // namespace media | 208 }; // namespace media |
| OLD | NEW |