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 // Unit test for VideoCaptureManager. | 5 // Unit test for VideoCaptureManager. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } else { | 94 } else { |
95 ASSERT_TRUE(NULL == controller); | 95 ASSERT_TRUE(NULL == controller); |
96 } | 96 } |
97 quit_closure.Run(); | 97 quit_closure.Run(); |
98 } | 98 } |
99 | 99 |
100 VideoCaptureControllerID StartClient(int session_id, bool expect_success) { | 100 VideoCaptureControllerID StartClient(int session_id, bool expect_success) { |
101 media::VideoCaptureParams params; | 101 media::VideoCaptureParams params; |
102 params.session_id = session_id; | 102 params.session_id = session_id; |
103 params.requested_format = media::VideoCaptureFormat( | 103 params.requested_format = media::VideoCaptureFormat( |
104 320, 240, 30, media::ConstantResolutionVideoCaptureDevice); | 104 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); |
105 | 105 |
106 VideoCaptureControllerID client_id(next_client_id_++); | 106 VideoCaptureControllerID client_id(next_client_id_++); |
107 base::RunLoop run_loop; | 107 base::RunLoop run_loop; |
108 vcm_->StartCaptureForClient( | 108 vcm_->StartCaptureForClient( |
109 params, base::kNullProcessHandle, client_id, frame_observer_.get(), | 109 params, base::kNullProcessHandle, client_id, frame_observer_.get(), |
110 base::Bind(&VideoCaptureManagerTest::OnGotControllerCallback, | 110 base::Bind(&VideoCaptureManagerTest::OnGotControllerCallback, |
111 base::Unretained(this), client_id, run_loop.QuitClosure(), | 111 base::Unretained(this), client_id, run_loop.QuitClosure(), |
112 expect_success)); | 112 expect_success)); |
113 run_loop.Run(); | 113 run_loop.Run(); |
114 return client_id; | 114 return client_id; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // VideoCaptureManager destructor otherwise. | 285 // VideoCaptureManager destructor otherwise. |
286 vcm_->Close(video_session_id); | 286 vcm_->Close(video_session_id); |
287 StopClient(client_id); | 287 StopClient(client_id); |
288 | 288 |
289 // Wait to check callbacks before removing the listener | 289 // Wait to check callbacks before removing the listener |
290 message_loop_->RunUntilIdle(); | 290 message_loop_->RunUntilIdle(); |
291 vcm_->Unregister(); | 291 vcm_->Unregister(); |
292 } | 292 } |
293 | 293 |
294 } // namespace content | 294 } // namespace content |
OLD | NEW |