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

Unified Diff: chrome/browser/search/hotword_service_unittest.cc

Issue 1211273003: Disable "Ok Google" hotwording in open source builds by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hotword-clarify-labels
Patch Set: Rebase properly. Created 5 years, 6 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 | « chrome/browser/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/hotword_service_unittest.cc
diff --git a/chrome/browser/search/hotword_service_unittest.cc b/chrome/browser/search/hotword_service_unittest.cc
index e78e2e783bfe7520183b6e077db3961b6775eaf4..521bb7b9ff3d58308a45944a47f9ad2caea70e49 100644
--- a/chrome/browser/search/hotword_service_unittest.cc
+++ b/chrome/browser/search/hotword_service_unittest.cc
@@ -157,8 +157,8 @@ INSTANTIATE_TEST_CASE_P(HotwordServiceTests,
::testing::Values(
extension_misc::kHotwordSharedModuleId));
-TEST_P(HotwordServiceTest, IsHotwordAllowedDisabledFieldTrial) {
-#if defined(ENABLE_HOTWORDING)
+// Disabled due to http://crbug.com/503963.
+TEST_P(HotwordServiceTest, DISABLED_IsHotwordAllowedDisabledFieldTrial) {
TestingProfile::Builder profile_builder;
scoped_ptr<TestingProfile> profile = profile_builder.Build();
@@ -191,11 +191,10 @@ TEST_P(HotwordServiceTest, IsHotwordAllowedDisabledFieldTrial) {
// Test that incognito returns false as well.
EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(
profile->GetOffTheRecordProfile()));
-#endif
}
-TEST_P(HotwordServiceTest, IsHotwordAllowedInvalidFieldTrial) {
-#if defined(ENABLE_HOTWORDING)
+// Disabled due to http://crbug.com/503963.
+TEST_P(HotwordServiceTest, DISABLED_IsHotwordAllowedInvalidFieldTrial) {
TestingProfile::Builder profile_builder;
scoped_ptr<TestingProfile> profile = profile_builder.Build();
@@ -216,14 +215,19 @@ TEST_P(HotwordServiceTest, IsHotwordAllowedInvalidFieldTrial) {
// Test that incognito returns false as well.
EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(
profile->GetOffTheRecordProfile()));
-#endif
}
-TEST_P(HotwordServiceTest, IsHotwordAllowedLocale) {
-#if defined(ENABLE_HOTWORDING)
+// Disabled due to http://crbug.com/503963.
+TEST_P(HotwordServiceTest, DISABLED_IsHotwordAllowedLocale) {
TestingProfile::Builder profile_builder;
scoped_ptr<TestingProfile> profile = profile_builder.Build();
+#if defined(ENABLE_HOTWORDING)
+ bool hotwording_enabled = true;
+#else
+ bool hotwording_enabled = false;
+#endif
+
// Check that the service exists so that a NULL service be ruled out in
// following tests.
HotwordService* hotword_service =
@@ -236,22 +240,26 @@ TEST_P(HotwordServiceTest, IsHotwordAllowedLocale) {
// Now with valid locales it should be fine.
SetApplicationLocale(static_cast<Profile*>(profile.get()), "en");
- EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get()));
+ EXPECT_EQ(hotwording_enabled,
+ HotwordServiceFactory::IsHotwordAllowed(profile.get()));
SetApplicationLocale(static_cast<Profile*>(profile.get()), "en-US");
- EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get()));
+ EXPECT_EQ(hotwording_enabled,
+ HotwordServiceFactory::IsHotwordAllowed(profile.get()));
SetApplicationLocale(static_cast<Profile*>(profile.get()), "en_us");
- EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get()));
+ EXPECT_EQ(hotwording_enabled,
+ HotwordServiceFactory::IsHotwordAllowed(profile.get()));
SetApplicationLocale(static_cast<Profile*>(profile.get()), "de_DE");
- EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get()));
+ EXPECT_EQ(hotwording_enabled,
+ HotwordServiceFactory::IsHotwordAllowed(profile.get()));
SetApplicationLocale(static_cast<Profile*>(profile.get()), "fr_fr");
- EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile.get()));
+ EXPECT_EQ(hotwording_enabled,
+ HotwordServiceFactory::IsHotwordAllowed(profile.get()));
// Test that incognito even with a valid locale and valid field trial
// still returns false.
Profile* otr_profile = profile->GetOffTheRecordProfile();
SetApplicationLocale(otr_profile, "en");
EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(otr_profile));
-#endif // defined(ENABLE_HOTWORDING)
}
TEST_P(HotwordServiceTest, ShouldReinstallExtension) {
@@ -308,7 +316,6 @@ TEST_P(HotwordServiceTest, PreviousLanguageSetOnInstall) {
}
TEST_P(HotwordServiceTest, UninstallReinstallTriggeredCorrectly) {
-#if defined(ENABLE_HOTWORDING)
InitializeEmptyExtensionService();
service_->Init();
@@ -350,7 +357,12 @@ TEST_P(HotwordServiceTest, UninstallReinstallTriggeredCorrectly) {
// Switch the locale to a valid but different one.
SetApplicationLocale(profile(), "fr_fr");
+#if defined(ENABLE_HOTWORDING)
EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile()));
+#else
+ // Disabled due to http://crbug.com/503963.
+ // EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(profile()));
+#endif
// Different but valid locale so expect uninstall.
EXPECT_TRUE(hotword_service->MaybeReinstallHotwordExtension());
@@ -376,10 +388,14 @@ TEST_P(HotwordServiceTest, UninstallReinstallTriggeredCorrectly) {
// If the locale is set back to the last valid one, then an uninstall-install
// shouldn't be needed.
SetApplicationLocale(profile(), "fr_fr");
+#if defined(ENABLE_HOTWORDING)
EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile()));
+#else
+ // Disabled due to http://crbug.com/503963.
+ // EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(profile()));
+#endif
EXPECT_FALSE(hotword_service->MaybeReinstallHotwordExtension());
EXPECT_EQ(1, hotword_service->uninstall_count()); // no change
-#endif // defined(ENABLE_HOTWORDING)
}
TEST_P(HotwordServiceTest, DisableAlwaysOnOnLanguageChange) {
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698