diff options
author | Matt Giuca <mgiuca@chromium.org> | 2015-06-29 12:42:17 +1000 |
---|---|---|
committer | Matt Giuca <mgiuca@chromium.org> | 2015-06-29 02:43:24 +0000 |
commit | 86fb78f02492b2990307ed427c09670f2fff0d3b (patch) | |
tree | 1a1fd934d32ddfac2fe3d1ad035bdf4585b5fef5 | |
parent | 1f41bc7f0d9adcf02c1a75e15e04b28cbe715333 (diff) | |
download | chromium_src-86fb78f02492b2990307ed427c09670f2fff0d3b.zip chromium_src-86fb78f02492b2990307ed427c09670f2fff0d3b.tar.gz chromium_src-86fb78f02492b2990307ed427c09670f2fff0d3b.tar.bz2 |
Disable "Ok Google" hotwording in open source builds by default.
The compile-time flag "enable_hotwording" is now tied to
branding=Chrome (false by default unless making a Google Chrome build).
Note: Chromium will no longer download/install the Hotword Shared
Module, and will automatically remove the Hotword Shared Module on
startup if it was previously installed. To keep this functionality, add
"enable_hotwording=1" to GYP_DEFINES.
BUG=500922
Review URL: https://codereview.chromium.org/1200413003
Cr-Commit-Position: refs/heads/master@{#335874}
(cherry picked from commit 0366a5184a70b3eefb5fcef2c2e13721669f00d8)
Fix up HotwordServiceTest on Chrome-branded builds.
The ENABLE_HOTWORDING flag is not available in
hotword_service_unittest.cc, so all tests were assuming hotwording was
disabled (since r333548). This has been failing on Official builders
since r335874.
Since it's hard to resolve this in a simple way (we want to merge these
changes), just disabling the tests is the cleanest option for now.
BUG=503963
Review URL: https://codereview.chromium.org/1207163002
Cr-Commit-Position: refs/heads/master@{#336091}
(cherry picked from commit 8ef0bc35b1594ad013dc2ae1d6893e0091919271)
Resolved merge conflict: Disabled IsHotwordAllowedDisabledFieldTrial and
IsHotwordAllowedInvalidFieldTrial. These tests were deleted before the
upstream patch landed.
(Merge approval on http://crbug.com/500922#c69)
R=thakis@chromium.org
TBR=thakis@chromium.org
Review URL: https://codereview.chromium.org/1211273003.
Cr-Commit-Position: refs/branch-heads/2403@{#416}
Cr-Branched-From: f54b8097a9c45ed4ad308133d49f05325d6c5070-refs/heads/master@{#330231}
-rw-r--r-- | build/common.gypi | 10 | ||||
-rw-r--r-- | chrome/browser/BUILD.gn | 6 | ||||
-rw-r--r-- | chrome/browser/search/hotword_service_unittest.cc | 46 |
3 files changed, 44 insertions, 18 deletions
diff --git a/build/common.gypi b/build/common.gypi index ddb075c..2f3f209 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -381,8 +381,10 @@ # Web speech is enabled by default. Set to 0 to disable. 'enable_web_speech%': 1, - # 'Ok Google' hotwording is enabled by default. Set to 0 to disable. - 'enable_hotwording%': 1, + # 'Ok Google' hotwording is disabled by default in open source builds. Set + # to 1 to enable. (This will download a closed-source NaCl module at + # startup.) Chrome-branded builds have this enabled by default. + 'enable_hotwording%': 0, # Notifications are compiled in by default. Set to 0 to disable. 'notifications%' : 1, @@ -813,6 +815,10 @@ ] }], + ['branding=="Chrome"', { + 'enable_hotwording%': 1, + }], + ['OS=="android"', { 'enable_webrtc%': 1, }], diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 6ccb079..8b7e0fe 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -19,8 +19,10 @@ if (is_desktop_linux) { } declare_args() { - # 'Ok Google' hotwording is enabled. - enable_hotwording = true + # 'Ok Google' hotwording is disabled by default in open source builds. Set to + # true to enable. (This will download a closed-source NaCl module at startup.) + # Chrome-branded builds have this enabled by default. + enable_hotwording = is_chrome_branded } about_credits_file = "$target_gen_dir/about_credits.html" diff --git a/chrome/browser/search/hotword_service_unittest.cc b/chrome/browser/search/hotword_service_unittest.cc index e78e2e7..25f4aa3 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(); @@ -194,8 +194,8 @@ TEST_P(HotwordServiceTest, IsHotwordAllowedDisabledFieldTrial) { #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(); @@ -219,11 +219,17 @@ TEST_P(HotwordServiceTest, IsHotwordAllowedInvalidFieldTrial) { #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 +242,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 +318,6 @@ TEST_P(HotwordServiceTest, PreviousLanguageSetOnInstall) { } TEST_P(HotwordServiceTest, UninstallReinstallTriggeredCorrectly) { -#if defined(ENABLE_HOTWORDING) InitializeEmptyExtensionService(); service_->Init(); @@ -350,7 +359,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 +390,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) { |