Commit df338050 authored by kcarattini's avatar kcarattini Committed by Commit bot

Hotword Private API: Adds speech training functions.

BUG=397019, 390086

Review URL: https://codereview.chromium.org/686333002

Cr-Commit-Position: refs/heads/master@{#302409}
parent 45bc8c57
...@@ -64,7 +64,9 @@ const char* HotwordPrivateEventService::service_name() { ...@@ -64,7 +64,9 @@ const char* HotwordPrivateEventService::service_name() {
void HotwordPrivateEventService::OnEnabledChanged( void HotwordPrivateEventService::OnEnabledChanged(
const std::string& pref_name) { const std::string& pref_name) {
DCHECK(pref_name == std::string(prefs::kHotwordSearchEnabled) || DCHECK(pref_name == std::string(prefs::kHotwordSearchEnabled) ||
pref_name == std::string(prefs::kHotwordAlwaysOnSearchEnabled)); pref_name == std::string(prefs::kHotwordAlwaysOnSearchEnabled) ||
pref_name == std::string(
hotword_internal::kHotwordTrainingEnabled));
SignalEvent(OnEnabledChanged::kEventName); SignalEvent(OnEnabledChanged::kEventName);
} }
...@@ -76,6 +78,14 @@ void HotwordPrivateEventService::OnHotwordSessionStopped() { ...@@ -76,6 +78,14 @@ void HotwordPrivateEventService::OnHotwordSessionStopped() {
SignalEvent(api::hotword_private::OnHotwordSessionStopped::kEventName); SignalEvent(api::hotword_private::OnHotwordSessionStopped::kEventName);
} }
void HotwordPrivateEventService::OnFinalizeSpeakerModel() {
SignalEvent(api::hotword_private::OnFinalizeSpeakerModel::kEventName);
}
void HotwordPrivateEventService::OnHotwordTriggered() {
SignalEvent(api::hotword_private::OnHotwordTriggered::kEventName);
}
void HotwordPrivateEventService::SignalEvent(const std::string& event_name) { void HotwordPrivateEventService::SignalEvent(const std::string& event_name) {
EventRouter* router = EventRouter::Get(profile_); EventRouter* router = EventRouter::Get(profile_);
if (!router || !router->HasEventListener(event_name)) if (!router || !router->HasEventListener(event_name))
...@@ -123,10 +133,13 @@ bool HotwordPrivateGetStatusFunction::RunSync() { ...@@ -123,10 +133,13 @@ bool HotwordPrivateGetStatusFunction::RunSync() {
HotwordService* hotword_service = HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(GetProfile()); HotwordServiceFactory::GetForProfile(GetProfile());
if (!hotword_service) if (!hotword_service) {
result.available = false; result.available = false;
else } else {
result.available = hotword_service->IsServiceAvailable(); result.available = hotword_service->IsServiceAvailable();
result.audio_logging_enabled = hotword_service->IsOptedIntoAudioLogging();
result.training_enabled = hotword_service->IsTraining();
}
PrefService* prefs = GetProfile()->GetPrefs(); PrefService* prefs = GetProfile()->GetPrefs();
result.enabled_set = prefs->HasPrefPath(prefs::kHotwordSearchEnabled); result.enabled_set = prefs->HasPrefPath(prefs::kHotwordSearchEnabled);
...@@ -137,8 +150,6 @@ bool HotwordPrivateGetStatusFunction::RunSync() { ...@@ -137,8 +150,6 @@ bool HotwordPrivateGetStatusFunction::RunSync() {
CommandLine* command_line = CommandLine::ForCurrentProcess(); CommandLine* command_line = CommandLine::ForCurrentProcess();
result.experimental_hotword_enabled = command_line->HasSwitch( result.experimental_hotword_enabled = command_line->HasSwitch(
switches::kEnableExperimentalHotwording); switches::kEnableExperimentalHotwording);
if (hotword_service)
result.audio_logging_enabled = hotword_service->IsOptedIntoAudioLogging();
SetResult(result.ToValue().release()); SetResult(result.ToValue().release());
return true; return true;
...@@ -151,7 +162,9 @@ bool HotwordPrivateSetHotwordSessionStateFunction::RunSync() { ...@@ -151,7 +162,9 @@ bool HotwordPrivateSetHotwordSessionStateFunction::RunSync() {
HotwordService* hotword_service = HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(GetProfile()); HotwordServiceFactory::GetForProfile(GetProfile());
if (hotword_service && hotword_service->client()) if (hotword_service &&
hotword_service->client() &&
!hotword_service->IsTraining())
hotword_service->client()->OnHotwordStateChanged(params->started); hotword_service->client()->OnHotwordStateChanged(params->started);
return true; return true;
} }
...@@ -160,7 +173,9 @@ bool HotwordPrivateNotifyHotwordRecognitionFunction::RunSync() { ...@@ -160,7 +173,9 @@ bool HotwordPrivateNotifyHotwordRecognitionFunction::RunSync() {
HotwordService* hotword_service = HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(GetProfile()); HotwordServiceFactory::GetForProfile(GetProfile());
if (hotword_service) { if (hotword_service) {
if (hotword_service->client()) { if (hotword_service->IsTraining()) {
hotword_service->NotifyHotwordTriggered();
} else if (hotword_service->client()) {
hotword_service->client()->OnHotwordRecognized(); hotword_service->client()->OnHotwordRecognized();
} else if (HotwordService::IsExperimentalHotwordingEnabled() && } else if (HotwordService::IsExperimentalHotwordingEnabled() &&
hotword_service->IsAlwaysOnEnabled()) { hotword_service->IsAlwaysOnEnabled()) {
...@@ -177,19 +192,53 @@ bool HotwordPrivateNotifyHotwordRecognitionFunction::RunSync() { ...@@ -177,19 +192,53 @@ bool HotwordPrivateNotifyHotwordRecognitionFunction::RunSync() {
} }
bool HotwordPrivateGetLaunchStateFunction::RunSync() { bool HotwordPrivateGetLaunchStateFunction::RunSync() {
HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(GetProfile());
if (!hotword_service) {
error_ = hotword_private_constants::kHotwordServiceUnavailable;
return false;
}
api::hotword_private::LaunchState result; api::hotword_private::LaunchState result;
result.launch_mode =
hotword_service->GetHotwordAudioVerificationLaunchMode();
SetResult(result.ToValue().release());
return true;
}
bool HotwordPrivateStartTrainingFunction::RunSync() {
HotwordService* hotword_service = HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(GetProfile()); HotwordServiceFactory::GetForProfile(GetProfile());
if (!hotword_service) { if (!hotword_service) {
error_ = hotword_private_constants::kHotwordServiceUnavailable; error_ = hotword_private_constants::kHotwordServiceUnavailable;
return false; return false;
} else {
result.launch_mode =
hotword_service->GetHotwordAudioVerificationLaunchMode();
} }
SetResult(result.ToValue().release()); hotword_service->StartTraining();
return true;
}
bool HotwordPrivateFinalizeSpeakerModelFunction::RunSync() {
HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(GetProfile());
if (!hotword_service) {
error_ = hotword_private_constants::kHotwordServiceUnavailable;
return false;
}
hotword_service->FinalizeSpeakerModel();
return true;
}
bool HotwordPrivateStopTrainingFunction::RunSync() {
HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(GetProfile());
if (!hotword_service) {
error_ = hotword_private_constants::kHotwordServiceUnavailable;
return false;
}
hotword_service->StopTraining();
return true; return true;
} }
......
...@@ -34,6 +34,10 @@ class HotwordPrivateEventService : public BrowserContextKeyedAPI { ...@@ -34,6 +34,10 @@ class HotwordPrivateEventService : public BrowserContextKeyedAPI {
void OnHotwordSessionStopped(); void OnHotwordSessionStopped();
void OnHotwordTriggered();
void OnFinalizeSpeakerModel();
private: private:
friend class BrowserContextKeyedAPIFactory<HotwordPrivateEventService>; friend class BrowserContextKeyedAPIFactory<HotwordPrivateEventService>;
...@@ -133,6 +137,45 @@ class HotwordPrivateGetLaunchStateFunction : ...@@ -133,6 +137,45 @@ class HotwordPrivateGetLaunchStateFunction :
bool RunSync() override; bool RunSync() override;
}; };
class HotwordPrivateStartTrainingFunction :
public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("hotwordPrivate.startTraining",
HOTWORDPRIVATE_STARTTRAINING)
protected:
~HotwordPrivateStartTrainingFunction() override {}
// ExtensionFunction:
bool RunSync() override;
};
class HotwordPrivateFinalizeSpeakerModelFunction :
public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("hotwordPrivate.finalizeSpeakerModel",
HOTWORDPRIVATE_FINALIZESPEAKERMODEL)
protected:
~HotwordPrivateFinalizeSpeakerModelFunction() override {}
// ExtensionFunction:
bool RunSync() override;
};
class HotwordPrivateStopTrainingFunction :
public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("hotwordPrivate.stopTraining",
HOTWORDPRIVATE_STOPTRAINING)
protected:
~HotwordPrivateStopTrainingFunction() override {}
// ExtensionFunction:
bool RunSync() override;
};
} // namespace extensions } // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_ #endif // CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_
...@@ -244,6 +244,10 @@ IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, OnEnabledChanged) { ...@@ -244,6 +244,10 @@ IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, OnEnabledChanged) {
profile()->GetPrefs()->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled, profile()->GetPrefs()->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled,
true); true);
EXPECT_TRUE(listenerNotification.WaitUntilSatisfied()); EXPECT_TRUE(listenerNotification.WaitUntilSatisfied());
listenerNotification.Reset();
service()->StartTraining();
EXPECT_TRUE(listenerNotification.WaitUntilSatisfied());
} }
IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, HotwordSession) { IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, HotwordSession) {
...@@ -269,7 +273,7 @@ IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, HotwordSession) { ...@@ -269,7 +273,7 @@ IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, HotwordSession) {
IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, GetLaunchStateHotwordOnly) { IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, GetLaunchStateHotwordOnly) {
service()->SetHotwordAudioVerificationLaunchMode( service()->SetHotwordAudioVerificationLaunchMode(
HotwordService::HOTWORD_ONLY); HotwordService::HOTWORD_ONLY);
ExtensionTestMessageListener listener("launchMode: 1", false); ExtensionTestMessageListener listener("launchMode: 0", false);
ASSERT_TRUE(RunComponentExtensionTest("getLaunchState")) << message_; ASSERT_TRUE(RunComponentExtensionTest("getLaunchState")) << message_;
EXPECT_TRUE(listener.WaitUntilSatisfied()); EXPECT_TRUE(listener.WaitUntilSatisfied());
} }
...@@ -278,7 +282,49 @@ IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, ...@@ -278,7 +282,49 @@ IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest,
GetLaunchStateHotwordAudioHistory) { GetLaunchStateHotwordAudioHistory) {
service()->SetHotwordAudioVerificationLaunchMode( service()->SetHotwordAudioVerificationLaunchMode(
HotwordService::HOTWORD_AND_AUDIO_HISTORY); HotwordService::HOTWORD_AND_AUDIO_HISTORY);
ExtensionTestMessageListener listener("launchMode: 2", false); ExtensionTestMessageListener listener("launchMode: 1", false);
ASSERT_TRUE(RunComponentExtensionTest("getLaunchState")) << message_; ASSERT_TRUE(RunComponentExtensionTest("getLaunchState")) << message_;
EXPECT_TRUE(listener.WaitUntilSatisfied()); EXPECT_TRUE(listener.WaitUntilSatisfied());
} }
IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, OnFinalizeSpeakerModel) {
// Trigger the pref registrar.
extensions::HotwordPrivateEventService::GetFactoryInstance();
ExtensionTestMessageListener listener("ready", false);
ASSERT_TRUE(
LoadExtensionAsComponent(test_data_dir_.AppendASCII(
"onFinalizeSpeakerModel")));
EXPECT_TRUE(listener.WaitUntilSatisfied());
ExtensionTestMessageListener listenerNotification("notification", false);
service()->FinalizeSpeakerModel();
EXPECT_TRUE(listenerNotification.WaitUntilSatisfied());
}
IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, OnHotwordTriggered) {
// Trigger the pref registrar.
extensions::HotwordPrivateEventService::GetFactoryInstance();
ExtensionTestMessageListener listener("ready", false);
ASSERT_TRUE(
LoadExtensionAsComponent(test_data_dir_.AppendASCII(
"onHotwordTriggered")));
EXPECT_TRUE(listener.WaitUntilSatisfied());
ExtensionTestMessageListener listenerNotification("notification", false);
service()->NotifyHotwordTriggered();
EXPECT_TRUE(listenerNotification.WaitUntilSatisfied());
}
IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, Training) {
EXPECT_FALSE(service()->IsTraining());
ExtensionTestMessageListener listenerTrue("start training", false);
ASSERT_TRUE(RunComponentExtensionTest("startTraining")) << message_;
EXPECT_TRUE(listenerTrue.WaitUntilSatisfied());
EXPECT_TRUE(service()->IsTraining());
ExtensionTestMessageListener listenerFalse("stop training", false);
ASSERT_TRUE(RunComponentExtensionTest("stopTraining")) << message_;
EXPECT_TRUE(listenerFalse.WaitUntilSatisfied());
EXPECT_FALSE(service()->IsTraining());
}
...@@ -163,6 +163,8 @@ const char kHotwordFieldTrialName[] = "VoiceTrigger"; ...@@ -163,6 +163,8 @@ const char kHotwordFieldTrialName[] = "VoiceTrigger";
const char kHotwordFieldTrialDisabledGroupName[] = "Disabled"; const char kHotwordFieldTrialDisabledGroupName[] = "Disabled";
// Old preference constant. // Old preference constant.
const char kHotwordUnusablePrefName[] = "hotword.search_enabled"; const char kHotwordUnusablePrefName[] = "hotword.search_enabled";
// String passed to indicate the training state has changed.
const char kHotwordTrainingEnabled[] = "hotword_training_enabled";
} // namespace hotword_internal } // namespace hotword_internal
// static // static
...@@ -190,6 +192,7 @@ HotwordService::HotwordService(Profile* profile) ...@@ -190,6 +192,7 @@ HotwordService::HotwordService(Profile* profile)
client_(NULL), client_(NULL),
error_message_(0), error_message_(0),
reinstall_pending_(false), reinstall_pending_(false),
training_(false),
weak_factory_(this) { weak_factory_(this) {
extension_registry_observer_.Add(extensions::ExtensionRegistry::Get(profile)); extension_registry_observer_.Add(extensions::ExtensionRegistry::Get(profile));
// This will be called during profile initialization which is a good time // This will be called during profile initialization which is a good time
...@@ -477,6 +480,54 @@ HotwordService::GetHotwordAudioVerificationLaunchMode() { ...@@ -477,6 +480,54 @@ HotwordService::GetHotwordAudioVerificationLaunchMode() {
return hotword_audio_verification_launch_mode_; return hotword_audio_verification_launch_mode_;
} }
void HotwordService::StartTraining() {
training_ = true;
if (!IsServiceAvailable())
return;
HotwordPrivateEventService* event_service =
BrowserContextKeyedAPIFactory<HotwordPrivateEventService>::Get(profile_);
if (event_service)
event_service->OnEnabledChanged(hotword_internal::kHotwordTrainingEnabled);
}
void HotwordService::FinalizeSpeakerModel() {
if (!IsServiceAvailable())
return;
HotwordPrivateEventService* event_service =
BrowserContextKeyedAPIFactory<HotwordPrivateEventService>::Get(profile_);
if (event_service)
event_service->OnFinalizeSpeakerModel();
}
void HotwordService::StopTraining() {
training_ = false;
if (!IsServiceAvailable())
return;
HotwordPrivateEventService* event_service =
BrowserContextKeyedAPIFactory<HotwordPrivateEventService>::Get(profile_);
if (event_service)
event_service->OnEnabledChanged(hotword_internal::kHotwordTrainingEnabled);
}
void HotwordService::NotifyHotwordTriggered() {
if (!IsServiceAvailable())
return;
HotwordPrivateEventService* event_service =
BrowserContextKeyedAPIFactory<HotwordPrivateEventService>::Get(profile_);
if (event_service)
event_service->OnHotwordTriggered();
}
bool HotwordService::IsTraining() {
return training_;
}
void HotwordService::OnHotwordSearchEnabledChanged( void HotwordService::OnHotwordSearchEnabledChanged(
const std::string& pref_name) { const std::string& pref_name) {
DCHECK_EQ(pref_name, std::string(prefs::kHotwordSearchEnabled)); DCHECK_EQ(pref_name, std::string(prefs::kHotwordSearchEnabled));
......
...@@ -29,6 +29,8 @@ namespace hotword_internal { ...@@ -29,6 +29,8 @@ namespace hotword_internal {
// Constants for the hotword field trial. // Constants for the hotword field trial.
extern const char kHotwordFieldTrialName[]; extern const char kHotwordFieldTrialName[];
extern const char kHotwordFieldTrialDisabledGroupName[]; extern const char kHotwordFieldTrialDisabledGroupName[];
// String passed to indicate the training state has changed.
extern const char kHotwordTrainingEnabled[];
} // namespace hotword_internal } // namespace hotword_internal
// Provides an interface for the Hotword component that does voice triggered // Provides an interface for the Hotword component that does voice triggered
...@@ -110,14 +112,24 @@ class HotwordService : public extensions::ExtensionRegistryObserver, ...@@ -110,14 +112,24 @@ class HotwordService : public extensions::ExtensionRegistryObserver,
// at which time we can simply launch the app in the given mode instead of // at which time we can simply launch the app in the given mode instead of
// having to check for it here. // having to check for it here.
enum LaunchMode { enum LaunchMode {
AUDIO_HISTORY_ONLY,
HOTWORD_ONLY, HOTWORD_ONLY,
HOTWORD_AND_AUDIO_HISTORY, HOTWORD_AND_AUDIO_HISTORY,
SPEECH_TRAINING RETRAIN
}; };
void LaunchHotwordAudioVerificationApp(const LaunchMode& launch_mode); void LaunchHotwordAudioVerificationApp(const LaunchMode& launch_mode);
virtual LaunchMode GetHotwordAudioVerificationLaunchMode(); virtual LaunchMode GetHotwordAudioVerificationLaunchMode();
// These methods control the speaker training communication between
// the Hotword Audio Verification App and the Hotword Extension that
// contains the NaCl module.
void StartTraining();
void FinalizeSpeakerModel();
void StopTraining();
void NotifyHotwordTriggered();
// Returns true if speaker training is currently in progress.
bool IsTraining();
private: private:
// Returns the ID of the extension that may need to be reinstalled. // Returns the ID of the extension that may need to be reinstalled.
std::string ReinstalledExtensionId(); std::string ReinstalledExtensionId();
...@@ -140,6 +152,8 @@ class HotwordService : public extensions::ExtensionRegistryObserver, ...@@ -140,6 +152,8 @@ class HotwordService : public extensions::ExtensionRegistryObserver,
HotwordClient* client_; HotwordClient* client_;
int error_message_; int error_message_;
bool reinstall_pending_; bool reinstall_pending_;
// Whether we are currently in the process of training the speaker model.
bool training_;
base::WeakPtrFactory<HotwordService> weak_factory_; base::WeakPtrFactory<HotwordService> weak_factory_;
......
...@@ -1670,7 +1670,7 @@ void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp( ...@@ -1670,7 +1670,7 @@ void BrowserOptionsHandler::HandleLaunchHotwordAudioVerificationApp(
DCHECK(profile->GetPrefs()->GetBoolean( DCHECK(profile->GetPrefs()->GetBoolean(
prefs::kHotwordAudioLoggingEnabled)); prefs::kHotwordAudioLoggingEnabled));
launch_mode = HotwordService::SPEECH_TRAINING; launch_mode = HotwordService::RETRAIN;
} else if (profile->GetPrefs()->GetBoolean( } else if (profile->GetPrefs()->GetBoolean(
prefs::kHotwordAudioLoggingEnabled)) { prefs::kHotwordAudioLoggingEnabled)) {
DCHECK(!profile->GetPrefs()->GetBoolean( DCHECK(!profile->GetPrefs()->GetBoolean(
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
// Whether always-on hotwording is enabled. // Whether always-on hotwording is enabled.
boolean alwaysOnEnabled; boolean alwaysOnEnabled;
// Whether training mode is enabled.
boolean trainingEnabled;
}; };
dictionary LaunchState { dictionary LaunchState {
...@@ -85,10 +88,21 @@ ...@@ -85,10 +88,21 @@
// Retrieves the state that the Hotword Audio Verification app was // Retrieves the state that the Hotword Audio Verification app was
// launched in. The result is put into a LaunchState object. // launched in. The result is put into a LaunchState object.
static void getLaunchState(LaunchStateCallback callback); static void getLaunchState(LaunchStateCallback callback);
// Starts the speaker model training.
static void startTraining(optional GenericDoneCallback callback);
// Finalizess the speaker model.
static void finalizeSpeakerModel(optional GenericDoneCallback callback);
// Stops the speaker model training.
static void stopTraining(optional GenericDoneCallback callback);
}; };
interface Events { interface Events {
// Fired when the hotword search enabled preference is changed. // Fired when the hotword detector enabled state should be changed.
// This can be from various sources, e.g. a pref change or training
// a speaker model.
static void onEnabledChanged(); static void onEnabledChanged();
// Fired when the browser wants to start a hotword session. // Fired when the browser wants to start a hotword session.
...@@ -96,5 +110,11 @@ ...@@ -96,5 +110,11 @@
// Fired when the browser wants to stop the requested hotword session. // Fired when the browser wants to stop the requested hotword session.
static void onHotwordSessionStopped(); static void onHotwordSessionStopped();
// Fired when the speaker model should be finalized.
static void onFinalizeSpeakerModel();
// Fired when a hotword has triggered.
static void onHotwordTriggered();
}; };
}; };
{
// chrome-extension://cpfhkdbjfdgdebcjlifoldbijinjfifp/
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCXAxIB5iu+XGtMYYJgSwMrqO+zNa3FlWeMJLOV+U1T2VL6wDU3WD9YNlioI6a6wG49AFquEbRxQwwxlvAZC1c95LBvRlnQAkEVum0KbrJ8WHTxxDEPOfITE0J1AP5j8V0WQ9jbYvUxgefIPhDPXHpdPRAxDotygTrPa33x1075wIDAQAB",
"name": "Hotword Private Test Extension",
"version": "0.1",
"manifest_version": 2,
"description": "Browser tests for chrome.hotword_private API",
"background" : {
"scripts": ["test.js"]
},
"permissions": ["hotwordPrivate"]
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chrome.test.runTests([
function onFinalizeSpeakerModel() {
chrome.hotwordPrivate.onFinalizeSpeakerModel.addListener(function () {
chrome.test.sendMessage("notification");
chrome.test.succeed();
});
chrome.test.sendMessage("ready");
}
]);
{
// chrome-extension://cpfhkdbjfdgdebcjlifoldbijinjfifp/
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCXAxIB5iu+XGtMYYJgSwMrqO+zNa3FlWeMJLOV+U1T2VL6wDU3WD9YNlioI6a6wG49AFquEbRxQwwxlvAZC1c95LBvRlnQAkEVum0KbrJ8WHTxxDEPOfITE0J1AP5j8V0WQ9jbYvUxgefIPhDPXHpdPRAxDotygTrPa33x1075wIDAQAB",
"name": "Hotword Private Test Extension",
"version": "0.1",
"manifest_version": 2,
"description": "Browser tests for chrome.hotword_private API",
"background" : {
"scripts": ["test.js"]
},
"permissions": ["hotwordPrivate"]
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chrome.test.runTests([
function onHotwordTriggered() {
chrome.hotwordPrivate.onHotwordTriggered.addListener(function () {
chrome.test.sendMessage("notification");
chrome.test.succeed();
});
chrome.test.sendMessage("ready");
}
]);
{
// chrome-extension://cpfhkdbjfdgdebcjlifoldbijinjfifp/
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCXAxIB5iu+XGtMYYJgSwMrqO+zNa3FlWeMJLOV+U1T2VL6wDU3WD9YNlioI6a6wG49AFquEbRxQwwxlvAZC1c95LBvRlnQAkEVum0KbrJ8WHTxxDEPOfITE0J1AP5j8V0WQ9jbYvUxgefIPhDPXHpdPRAxDotygTrPa33x1075wIDAQAB",
"name": "Hotword Private Test Extension",
"version": "0.1",
"manifest_version": 2,
"description": "Browser tests for chrome.hotword_private API",
"background" : {
"scripts": ["test.js"]
},
"permissions": ["hotwordPrivate"]
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chrome.test.runTests([
function startTraining() {
chrome.hotwordPrivate.startTraining(chrome.test.callbackPass(function() {
chrome.test.sendMessage("start training");
}));
}
]);
{
// chrome-extension://cpfhkdbjfdgdebcjlifoldbijinjfifp/
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCXAxIB5iu+XGtMYYJgSwMrqO+zNa3FlWeMJLOV+U1T2VL6wDU3WD9YNlioI6a6wG49AFquEbRxQwwxlvAZC1c95LBvRlnQAkEVum0KbrJ8WHTxxDEPOfITE0J1AP5j8V0WQ9jbYvUxgefIPhDPXHpdPRAxDotygTrPa33x1075wIDAQAB",
"name": "Hotword Private Test Extension",
"version": "0.1",
"manifest_version": 2,
"description": "Browser tests for chrome.hotword_private API",
"background" : {
"scripts": ["test.js"]
},
"permissions": ["hotwordPrivate"]
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chrome.test.runTests([
function stopTraining() {
chrome.hotwordPrivate.stopTraining(chrome.test.callbackPass(function() {
chrome.test.sendMessage("stop training");
}));
}
]);
...@@ -970,6 +970,9 @@ enum HistogramValue { ...@@ -970,6 +970,9 @@ enum HistogramValue {
WALLPAPERPRIVATE_GETSYNCSETTING, WALLPAPERPRIVATE_GETSYNCSETTING,
COPRESENCE_SETAUTHTOKEN, COPRESENCE_SETAUTHTOKEN,
CAST_CHANNEL_SETAUTHORITYKEYS, CAST_CHANNEL_SETAUTHORITYKEYS,
HOTWORDPRIVATE_STARTTRAINING,
HOTWORDPRIVATE_FINALIZESPEAKERMODEL,
HOTWORDPRIVATE_STOPTRAINING,
// Last entry: Add new entries above and ensure to update // Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms.xml. // tools/metrics/histograms/histograms.xml.
ENUM_BOUNDARY ENUM_BOUNDARY
......
...@@ -44106,6 +44106,9 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -44106,6 +44106,9 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="909" label="WALLPAPERPRIVATE_GETSYNCSETTING"/> <int value="909" label="WALLPAPERPRIVATE_GETSYNCSETTING"/>
<int value="910" label="COPRESENCE_SETAUTHTOKEN"/> <int value="910" label="COPRESENCE_SETAUTHTOKEN"/>
<int value="911" label="CAST_CHANNEL_SETAUTHORITYKEYS"/> <int value="911" label="CAST_CHANNEL_SETAUTHORITYKEYS"/>
<int value="912" label="HOTWORDPRIVATE_STARTTRAINING"/>
<int value="913" label="HOTWORDPRIVATE_FINALIZESPEAKERMODEL"/>
<int value="914" label="HOTWORDPRIVATE_STOPTRAINING"/>
</enum> </enum>
<enum name="ExtensionInstallCause" type="int"> <enum name="ExtensionInstallCause" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment