| 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/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 public: | 70 public: |
| 71 VideoCaptureImplManagerTest() | 71 VideoCaptureImplManagerTest() |
| 72 : manager_(new MockVideoCaptureImplManager( | 72 : manager_(new MockVideoCaptureImplManager( |
| 73 BindToCurrentLoop(cleanup_run_loop_.QuitClosure()))) { | 73 BindToCurrentLoop(cleanup_run_loop_.QuitClosure()))) { |
| 74 params_.requested_format = media::VideoCaptureFormat( | 74 params_.requested_format = media::VideoCaptureFormat( |
| 75 gfx::Size(176, 144), 30, media::PIXEL_FORMAT_I420); | 75 gfx::Size(176, 144), 30, media::PIXEL_FORMAT_I420); |
| 76 child_process_.reset(new ChildProcess()); | 76 child_process_.reset(new ChildProcess()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void FakeChannelSetup() { | 79 void FakeChannelSetup() { |
| 80 scoped_refptr<base::MessageLoopProxy> loop = | 80 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
| 81 child_process_->io_message_loop_proxy(); | 81 child_process_->io_task_runner(); |
| 82 if (!loop->BelongsToCurrentThread()) { | 82 if (!task_runner->BelongsToCurrentThread()) { |
| 83 loop->PostTask( | 83 task_runner->PostTask( |
| 84 FROM_HERE, | 84 FROM_HERE, base::Bind(&VideoCaptureImplManagerTest::FakeChannelSetup, |
| 85 base::Bind( | 85 base::Unretained(this))); |
| 86 &VideoCaptureImplManagerTest::FakeChannelSetup, | |
| 87 base::Unretained(this))); | |
| 88 return; | 86 return; |
| 89 } | 87 } |
| 90 manager_->video_capture_message_filter()->OnFilterAdded(NULL); | 88 manager_->video_capture_message_filter()->OnFilterAdded(NULL); |
| 91 } | 89 } |
| 92 | 90 |
| 93 protected: | 91 protected: |
| 94 MOCK_METHOD2(OnFrameReady, | 92 MOCK_METHOD2(OnFrameReady, |
| 95 void(const scoped_refptr<media::VideoFrame>&, | 93 void(const scoped_refptr<media::VideoFrame>&, |
| 96 const base::TimeTicks& estimated_capture_time)); | 94 const base::TimeTicks& estimated_capture_time)); |
| 97 MOCK_METHOD0(OnStarted, void()); | 95 MOCK_METHOD0(OnStarted, void()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 cleanup_run_loop_.Run(); | 159 cleanup_run_loop_.Run(); |
| 162 } | 160 } |
| 163 | 161 |
| 164 TEST_F(VideoCaptureImplManagerTest, NoLeak) { | 162 TEST_F(VideoCaptureImplManagerTest, NoLeak) { |
| 165 manager_->UseDevice(0).Reset(); | 163 manager_->UseDevice(0).Reset(); |
| 166 manager_.reset(); | 164 manager_.reset(); |
| 167 cleanup_run_loop_.Run(); | 165 cleanup_run_loop_.Run(); |
| 168 } | 166 } |
| 169 | 167 |
| 170 } // namespace content | 168 } // namespace content |
| OLD | NEW |