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

Unified Diff: media/audio/linux/audio_manager_linux.cc

Issue 2632733002: media: Use fake audio manager in headless mode (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/linux/audio_manager_linux.cc
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc
index 5d9676e60f97bf3822c2219fe5235196decdf410..5e2f6b7b87b0d481e68c1c5bc4886db32439775d 100644
--- a/media/audio/linux/audio_manager_linux.cc
+++ b/media/audio/linux/audio_manager_linux.cc
@@ -4,12 +4,12 @@
#include "base/command_line.h"
#include "base/metrics/histogram.h"
+#include "media/audio/fake_audio_manager.h"
#include "media/base/media_switches.h"
+#include "ui/gfx/switches.h"
#if defined(USE_ALSA)
#include "media/audio/alsa/audio_manager_alsa.h"
-#else
-#include "media/audio/fake_audio_manager.h"
#endif
#if defined(USE_CRAS)
#include "media/audio/cras/audio_manager_cras.h"
@@ -31,6 +31,12 @@ ScopedAudioManagerPtr CreateAudioManager(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
AudioLogFactory* audio_log_factory) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) {
tommi (sloooow) - chröme 2017/01/13 18:02:27 This is bringing in unit test code into production
Sami 2017/01/13 18:38:06 Sorry, which tests are you referring to? The --hea
Sami 2017/01/13 18:51:04 FWIW there's some more background about Headless C
+ return ScopedAudioManagerPtr(
+ new FakeAudioManager(std::move(task_runner),
+ std::move(worker_task_runner), audio_log_factory));
+ }
+
#if defined(USE_CRAS)
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseCras)) {
UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kCras, kAudioIOMax + 1);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698