Index: chrome/browser/search/hotword_service.cc |
diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc |
index b6b54ae69801b69b13e63629bc72266f4399512f..b7d16f132964c43cd9f783358342c6cb8d677267 100644 |
--- a/chrome/browser/search/hotword_service.cc |
+++ b/chrome/browser/search/hotword_service.cc |
@@ -49,6 +49,10 @@ |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/resource/resource_bundle.h" |
+#if defined(OS_CHROMEOS) |
+#include "chromeos/audio/cras_audio_handler.h" |
+#endif |
+ |
using extensions::BrowserContextKeyedAPIFactory; |
using extensions::HotwordPrivateEventService; |
@@ -307,6 +311,13 @@ HotwordService::HotwordService(Profile* profile) |
reinstall_pending_(false), |
training_(false), |
weak_factory_(this) { |
+#if defined(OS_CHROMEOS) |
+ // Tests on chromeos need to have the handler initialized. |
+ if (profile_->AsTestingProfile() && |
+ !chromeos::CrasAudioHandler::IsInitialized()) |
+ chromeos::CrasAudioHandler::InitializeForTesting(); |
+#endif |
+ |
extension_registry_observer_.Add(extensions::ExtensionRegistry::Get(profile)); |
if (IsExperimentalHotwordingEnabled()) { |
// Disable the old extension so it doesn't interfere with the new stuff. |