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

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

Issue 583833008: Set keyboard mic effect if available. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: This should be the correct setup and teardown order for tests. Created 6 years, 3 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
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.cc ('k') | content/test/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 16 matching lines...) Expand all
27 #include "content/public/test/test_browser_thread_bundle.h" 27 #include "content/public/test/test_browser_thread_bundle.h"
28 #include "content/test/test_content_browser_client.h" 28 #include "content/test/test_content_browser_client.h"
29 #include "media/audio/audio_manager.h" 29 #include "media/audio/audio_manager.h"
30 #include "media/base/media_switches.h" 30 #include "media/base/media_switches.h"
31 #include "media/base/video_frame.h" 31 #include "media/base/video_frame.h"
32 #include "media/video/capture/video_capture_types.h" 32 #include "media/video/capture/video_capture_types.h"
33 #include "net/url_request/url_request_context.h" 33 #include "net/url_request/url_request_context.h"
34 #include "testing/gmock/include/gmock/gmock.h" 34 #include "testing/gmock/include/gmock/gmock.h"
35 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
36 36
37 #if defined(OS_CHROMEOS)
38 #include "chromeos/audio/cras_audio_handler.h"
39 #endif
40
37 using ::testing::_; 41 using ::testing::_;
38 using ::testing::AtLeast; 42 using ::testing::AtLeast;
39 using ::testing::AnyNumber; 43 using ::testing::AnyNumber;
40 using ::testing::DoAll; 44 using ::testing::DoAll;
41 using ::testing::InSequence; 45 using ::testing::InSequence;
42 using ::testing::Mock; 46 using ::testing::Mock;
43 using ::testing::Return; 47 using ::testing::Return;
44 using ::testing::SaveArg; 48 using ::testing::SaveArg;
45 using ::testing::StrictMock; 49 using ::testing::StrictMock;
46 50
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // VideoCaptureDevice. 282 // VideoCaptureDevice.
279 class VideoCaptureHostTest : public testing::Test { 283 class VideoCaptureHostTest : public testing::Test {
280 public: 284 public:
281 VideoCaptureHostTest() 285 VideoCaptureHostTest()
282 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 286 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
283 message_loop_(base::MessageLoopProxy::current()), 287 message_loop_(base::MessageLoopProxy::current()),
284 opened_session_id_(kInvalidMediaCaptureSessionId) {} 288 opened_session_id_(kInvalidMediaCaptureSessionId) {}
285 289
286 virtual void SetUp() OVERRIDE { 290 virtual void SetUp() OVERRIDE {
287 SetBrowserClientForTesting(&browser_client_); 291 SetBrowserClientForTesting(&browser_client_);
292
293 #if defined(OS_CHROMEOS)
294 chromeos::CrasAudioHandler::InitializeForTesting();
295 #endif
296
288 // Create our own MediaStreamManager. 297 // Create our own MediaStreamManager.
289 audio_manager_.reset(media::AudioManager::CreateForTesting()); 298 audio_manager_.reset(media::AudioManager::CreateForTesting());
290 #ifndef TEST_REAL_CAPTURE_DEVICE 299 #ifndef TEST_REAL_CAPTURE_DEVICE
291 base::CommandLine::ForCurrentProcess()->AppendSwitch( 300 base::CommandLine::ForCurrentProcess()->AppendSwitch(
292 switches::kUseFakeDeviceForMediaStream); 301 switches::kUseFakeDeviceForMediaStream);
293 #endif 302 #endif
294 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); 303 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
295 media_stream_manager_->UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy>()); 304 media_stream_manager_->UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy>());
296 305
297 // Create a Host and connect it to a simulated IPC channel. 306 // Create a Host and connect it to a simulated IPC channel.
(...skipping 10 matching lines...) Expand all
308 EXPECT_EQ(0u, host_->entries_.size()); 317 EXPECT_EQ(0u, host_->entries_.size());
309 318
310 CloseSession(); 319 CloseSession();
311 320
312 // Simulate closing the IPC sender. 321 // Simulate closing the IPC sender.
313 host_->OnChannelClosing(); 322 host_->OnChannelClosing();
314 323
315 // Release the reference to the mock object. The object will be destructed 324 // Release the reference to the mock object. The object will be destructed
316 // on the current message loop. 325 // on the current message loop.
317 host_ = NULL; 326 host_ = NULL;
327
328 #if defined(OS_CHROMEOS)
329 chromeos::CrasAudioHandler::Shutdown();
330 #endif
318 } 331 }
319 332
320 void OpenSession() { 333 void OpenSession() {
321 const int render_process_id = 1; 334 const int render_process_id = 1;
322 const int render_frame_id = 1; 335 const int render_frame_id = 1;
323 const int page_request_id = 1; 336 const int page_request_id = 1;
324 const GURL security_origin("http://test.com"); 337 const GURL security_origin("http://test.com");
325 338
326 ASSERT_TRUE(opened_device_label_.empty()); 339 ASSERT_TRUE(opened_device_label_.empty());
327 340
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 #ifdef DUMP_VIDEO 550 #ifdef DUMP_VIDEO
538 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { 551 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) {
539 CaptureAndDumpVideo(640, 480, 30); 552 CaptureAndDumpVideo(640, 480, 30);
540 } 553 }
541 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { 554 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
542 CaptureAndDumpVideo(1280, 720, 30); 555 CaptureAndDumpVideo(1280, 720, 30);
543 } 556 }
544 #endif 557 #endif
545 558
546 } // namespace content 559 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.cc ('k') | content/test/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698