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

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

Issue 235353002: Extract VideoCaptureDeviceFactory out of VideoCaptureDevice and use for File and FakeVCD. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: perkj@s comments Created 6 years, 8 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
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/command_line.h"
8 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 10 #include "base/run_loop.h"
10 #include "content/browser/browser_thread_impl.h" 11 #include "content/browser/browser_thread_impl.h"
11 #include "content/browser/renderer_host/media/media_stream_manager.h" 12 #include "content/browser/renderer_host/media/media_stream_manager.h"
12 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" 13 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
13 #include "content/common/media/media_stream_options.h" 14 #include "content/common/media/media_stream_options.h"
15 #include "content/public/common/content_switches.h"
14 #include "content/public/test/test_browser_thread_bundle.h" 16 #include "content/public/test/test_browser_thread_bundle.h"
15 #include "media/audio/audio_manager_base.h" 17 #include "media/audio/audio_manager_base.h"
16 #include "media/audio/fake_audio_log_factory.h" 18 #include "media/audio/fake_audio_log_factory.h"
17 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
19 21
20 #if defined(USE_ALSA) 22 #if defined(USE_ALSA)
21 #include "media/audio/alsa/audio_manager_alsa.h" 23 #include "media/audio/alsa/audio_manager_alsa.h"
22 #elif defined(OS_ANDROID) 24 #elif defined(OS_ANDROID)
23 #include "media/audio/android/audio_manager_android.h" 25 #include "media/audio/android/audio_manager_android.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 private: 70 private:
69 media::FakeAudioLogFactory fake_audio_log_factory_; 71 media::FakeAudioLogFactory fake_audio_log_factory_;
70 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); 72 DISALLOW_COPY_AND_ASSIGN(MockAudioManager);
71 }; 73 };
72 74
73 class MediaStreamManagerTest : public ::testing::Test { 75 class MediaStreamManagerTest : public ::testing::Test {
74 public: 76 public:
75 MediaStreamManagerTest() 77 MediaStreamManagerTest()
76 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 78 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
77 message_loop_(base::MessageLoopProxy::current()) { 79 message_loop_(base::MessageLoopProxy::current()) {
78 // Create our own MediaStreamManager. 80 // Create our own MediaStreamManager. Use fake devices to run on the bots.
81 CommandLine::ForCurrentProcess()->AppendSwitch(
82 switches::kUseFakeDeviceForMediaStream);
79 audio_manager_.reset(new MockAudioManager()); 83 audio_manager_.reset(new MockAudioManager());
80 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); 84 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
81 85 }
82 // Use fake devices in order to run on the bots.
83 media_stream_manager_->UseFakeDevice();
84 }
85 86
86 virtual ~MediaStreamManagerTest() { 87 virtual ~MediaStreamManagerTest() {
87 } 88 }
88 89
89 MOCK_METHOD1(Response, void(int index)); 90 MOCK_METHOD1(Response, void(int index));
90 void ResponseCallback(int index, 91 void ResponseCallback(int index,
91 const MediaStreamDevices& devices, 92 const MediaStreamDevices& devices,
92 scoped_ptr<MediaStreamUIProxy> ui_proxy) { 93 scoped_ptr<MediaStreamUIProxy> ui_proxy) {
93 Response(index); 94 Response(index);
94 message_loop_->PostTask(FROM_HERE, run_loop_.QuitClosure()); 95 message_loop_->PostTask(FROM_HERE, run_loop_.QuitClosure());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 std::string label2 = MakeMediaAccessRequest(1); 173 std::string label2 = MakeMediaAccessRequest(1);
173 media_stream_manager_->CancelRequest(label1); 174 media_stream_manager_->CancelRequest(label1);
174 175
175 // Expecting the callback from the second request will be triggered and 176 // Expecting the callback from the second request will be triggered and
176 // quit the test. 177 // quit the test.
177 EXPECT_CALL(*this, Response(1)); 178 EXPECT_CALL(*this, Response(1));
178 run_loop_.Run(); 179 run_loop_.Run();
179 } 180 }
180 181
181 } // namespace content 182 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698