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

Unified Diff: chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc

Issue 1027683002: Hotword Private API: Add function and event to query the existence of a speaker model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Upload remaining test files Created 5 years, 9 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
Index: chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc
diff --git a/chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc b/chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc
index 07dea7be6762f6b788c7c212cf425af857956f5a..1dbf3567be3cbe13d8eab23a089db235ee9abc92 100644
--- a/chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc
+++ b/chrome/browser/extensions/api/hotword_private/hotword_private_apitest.cc
@@ -394,6 +394,41 @@ IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, OnDeleteSpeakerModel) {
EXPECT_TRUE(listenerNotification.WaitUntilSatisfied());
}
+IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, OnSpeakerModelExists) {
+ extensions::HotwordPrivateEventService::GetFactoryInstance();
+ ExtensionTestMessageListener listener("ready", false);
+ ASSERT_TRUE(
+ LoadExtensionAsComponent(test_data_dir_.AppendASCII(
+ "onSpeakerModelExists")));
+ EXPECT_TRUE(listener.WaitUntilSatisfied());
+
+ service()->OptIntoHotwording(HotwordService::HOTWORD_ONLY);
+
+ ExtensionTestMessageListener listenerNotification("notification", false);
+ EXPECT_TRUE(listenerNotification.WaitUntilSatisfied());
+}
+
+IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, SpeakerModelExistsResult) {
+ EXPECT_FALSE(profile()->GetPrefs()->GetBoolean(
+ prefs::kHotwordAlwaysOnSearchEnabled));
+
+ ExtensionTestMessageListener listenerTrue("ready", false);
+ ASSERT_TRUE(RunComponentExtensionTest(
+ "speakerModelExistsResultTrue")) << message_;
+ EXPECT_TRUE(listenerTrue.WaitUntilSatisfied());
+ EXPECT_TRUE(profile()->GetPrefs()->GetBoolean(
+ prefs::kHotwordAlwaysOnSearchEnabled));
+
+ PrefService* prefs = profile()->GetPrefs();
+ prefs->SetBoolean(prefs::kHotwordAlwaysOnSearchEnabled, false);
+ ExtensionTestMessageListener listenerFalse("ready", false);
+ ASSERT_TRUE(RunComponentExtensionTest(
+ "speakerModelExistsResultFalse")) << message_;
+ EXPECT_TRUE(listenerFalse.WaitUntilSatisfied());
+ EXPECT_FALSE(profile()->GetPrefs()->GetBoolean(
+ prefs::kHotwordAlwaysOnSearchEnabled));
+}
+
IN_PROC_BROWSER_TEST_F(HotwordPrivateApiTest, Training) {
EXPECT_FALSE(service()->IsTraining());
« no previous file with comments | « chrome/browser/extensions/api/hotword_private/hotword_private_api.cc ('k') | chrome/browser/search/hotword_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698