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

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

Issue 2696533002: Rmoving the notion of task runner from MediaStreamProvider interface. (Closed)
Patch Set: Created 3 years, 10 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
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 "content/browser/renderer_host/media/audio_input_device_manager.h" 5 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 void SetUp() override { 64 void SetUp() override {
65 base::CommandLine::ForCurrentProcess()->AppendSwitch( 65 base::CommandLine::ForCurrentProcess()->AppendSwitch(
66 switches::kUseFakeDeviceForMediaStream); 66 switches::kUseFakeDeviceForMediaStream);
67 audio_manager_ = media::AudioManager::CreateForTesting( 67 audio_manager_ = media::AudioManager::CreateForTesting(
68 base::ThreadTaskRunnerHandle::Get()); 68 base::ThreadTaskRunnerHandle::Get());
69 // Flush the message loop to ensure proper initialization of AudioManager. 69 // Flush the message loop to ensure proper initialization of AudioManager.
70 base::RunLoop().RunUntilIdle(); 70 base::RunLoop().RunUntilIdle();
71 71
72 manager_ = new AudioInputDeviceManager(audio_manager_.get()); 72 manager_ = new AudioInputDeviceManager(audio_manager_.get());
73 audio_input_listener_.reset(new MockAudioInputDeviceManagerListener()); 73 audio_input_listener_.reset(new MockAudioInputDeviceManagerListener());
74 manager_->Register(audio_input_listener_.get(), 74 manager_->RegisterListener(audio_input_listener_.get());
75 audio_manager_->GetTaskRunner());
76 75
77 // Use fake devices. 76 // Use fake devices.
78 devices_.emplace_back(MEDIA_DEVICE_AUDIO_CAPTURE, "Fake Device 1", 77 devices_.emplace_back(MEDIA_DEVICE_AUDIO_CAPTURE, "Fake Device 1",
79 "fake_device_1"); 78 "fake_device_1");
80 devices_.emplace_back(MEDIA_DEVICE_AUDIO_CAPTURE, "Fake Device 2", 79 devices_.emplace_back(MEDIA_DEVICE_AUDIO_CAPTURE, "Fake Device 2",
81 "fake_device_2"); 80 "fake_device_2");
82 81
83 // Wait until we get the list. 82 // Wait until we get the list.
84 base::RunLoop().RunUntilIdle(); 83 base::RunLoop().RunUntilIdle();
85 } 84 }
86 85
87 void TearDown() override { 86 void TearDown() override { manager_->UnregisterListener(); }
88 manager_->Unregister();
89 }
90 87
91 TestBrowserThreadBundle thread_bundle_; 88 TestBrowserThreadBundle thread_bundle_;
92 scoped_refptr<AudioInputDeviceManager> manager_; 89 scoped_refptr<AudioInputDeviceManager> manager_;
93 std::unique_ptr<MockAudioInputDeviceManagerListener> audio_input_listener_; 90 std::unique_ptr<MockAudioInputDeviceManagerListener> audio_input_listener_;
94 media::ScopedAudioManagerPtr audio_manager_; 91 media::ScopedAudioManagerPtr audio_manager_;
95 StreamDeviceInfoArray devices_; 92 StreamDeviceInfoArray devices_;
96 93
97 private: 94 private:
98 DISALLOW_COPY_AND_ASSIGN(MAYBE_AudioInputDeviceManagerTest); 95 DISALLOW_COPY_AND_ASSIGN(MAYBE_AudioInputDeviceManagerTest);
99 }; 96 };
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 DCHECK(!info); 273 DCHECK(!info);
277 274
278 manager_->Close(session_id); 275 manager_->Close(session_id);
279 EXPECT_CALL(*audio_input_listener_, 276 EXPECT_CALL(*audio_input_listener_,
280 Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id)) 277 Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
281 .Times(1); 278 .Times(1);
282 base::RunLoop().RunUntilIdle(); 279 base::RunLoop().RunUntilIdle();
283 } 280 }
284 281
285 } // namespace content 282 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698