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

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

Issue 13006011: Merge 189983 "Add speaker on/off control on Android for WebRTC " (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/test/webrtc_audio_device_test.cc » ('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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "content/browser/browser_thread_impl.h" 11 #include "content/browser/browser_thread_impl.h"
12 #include "content/browser/renderer_host/media/audio_input_device_manager.h" 12 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
13 #include "content/browser/renderer_host/media/audio_input_device_manager_event_h andler.h" 13 #include "content/browser/renderer_host/media/audio_input_device_manager_event_h andler.h"
14 #include "content/public/common/media_stream_request.h" 14 #include "content/public/common/media_stream_request.h"
15 #include "media/audio/audio_manager_base.h" 15 #include "media/audio/audio_manager_base.h"
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 #if defined(OS_ANDROID)
20 #include "base/android/jni_android.h"
21 #include "media/audio/audio_manager_base.h"
22 #endif
23
19 using testing::_; 24 using testing::_;
20 using testing::InSequence; 25 using testing::InSequence;
21 using testing::SaveArg; 26 using testing::SaveArg;
22 using testing::Return; 27 using testing::Return;
23 28
24 namespace content { 29 namespace content {
25 30
26 class MockAudioInputDeviceManagerListener 31 class MockAudioInputDeviceManagerListener
27 : public MediaStreamProviderListener { 32 : public MediaStreamProviderListener {
28 public: 33 public:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return audio_manager_->HasAudioInputDevices(); 85 return audio_manager_->HasAudioInputDevices();
81 } 86 }
82 87
83 protected: 88 protected:
84 virtual void SetUp() OVERRIDE { 89 virtual void SetUp() OVERRIDE {
85 // The test must run on Browser::IO. 90 // The test must run on Browser::IO.
86 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); 91 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO));
87 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO, 92 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO,
88 message_loop_.get())); 93 message_loop_.get()));
89 94
95 #if defined(OS_ANDROID)
96 media::AudioManagerBase::RegisterAudioManager(
97 base::android::AttachCurrentThread());
98 #endif
99
90 audio_manager_.reset(media::AudioManager::Create()); 100 audio_manager_.reset(media::AudioManager::Create());
91 manager_ = new AudioInputDeviceManager(audio_manager_.get()); 101 manager_ = new AudioInputDeviceManager(audio_manager_.get());
92 audio_input_listener_.reset(new MockAudioInputDeviceManagerListener()); 102 audio_input_listener_.reset(new MockAudioInputDeviceManagerListener());
93 manager_->Register(audio_input_listener_.get(), 103 manager_->Register(audio_input_listener_.get(),
94 message_loop_->message_loop_proxy()); 104 message_loop_->message_loop_proxy());
95 105
96 // Gets the enumerated device list from the AudioInputDeviceManager. 106 // Gets the enumerated device list from the AudioInputDeviceManager.
97 manager_->EnumerateDevices(MEDIA_DEVICE_AUDIO_CAPTURE); 107 manager_->EnumerateDevices(MEDIA_DEVICE_AUDIO_CAPTURE);
98 EXPECT_CALL(*audio_input_listener_, 108 EXPECT_CALL(*audio_input_listener_,
99 DevicesEnumerated(MEDIA_DEVICE_AUDIO_CAPTURE, _)) 109 DevicesEnumerated(MEDIA_DEVICE_AUDIO_CAPTURE, _))
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 479
470 manager_->Stop(session_id); 480 manager_->Stop(session_id);
471 manager_->Close(session_id); 481 manager_->Close(session_id);
472 EXPECT_CALL(*audio_input_listener_, 482 EXPECT_CALL(*audio_input_listener_,
473 Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id)) 483 Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
474 .Times(1); 484 .Times(1);
475 message_loop_->RunUntilIdle(); 485 message_loop_->RunUntilIdle();
476 } 486 }
477 487
478 } // namespace content 488 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/webrtc_audio_device_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698