diff options
author | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-03 21:41:41 +0000 |
---|---|---|
committer | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-03 21:41:41 +0000 |
commit | fc2c9554922894be6b9ad78239c0d764748edec4 (patch) | |
tree | 9446ef62f516380305702ae53cd36f5bca779119 | |
parent | 35e5a34c89fea82d21af4029ade095f7fd7506c2 (diff) | |
download | chromium_src-fc2c9554922894be6b9ad78239c0d764748edec4.zip chromium_src-fc2c9554922894be6b9ad78239c0d764748edec4.tar.gz chromium_src-fc2c9554922894be6b9ad78239c0d764748edec4.tar.bz2 |
[protector] Disable the UI by default, flip --no-protector to --protector.
BUG=None
TEST=Manual
Review URL: http://codereview.chromium.org/10298012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135219 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/protector/protector_service_browsertest.cc | 9 | ||||
-rw-r--r-- | chrome/browser/protector/protector_utils.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init.cc | 4 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 6 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 2 | ||||
-rwxr-xr-x | chrome/test/functional/protector.py | 32 |
6 files changed, 30 insertions, 25 deletions
diff --git a/chrome/browser/protector/protector_service_browsertest.cc b/chrome/browser/protector/protector_service_browsertest.cc index 936359f..8c7a902 100644 --- a/chrome/browser/protector/protector_service_browsertest.cc +++ b/chrome/browser/protector/protector_service_browsertest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "chrome/app/chrome_command_ids.h" @@ -14,6 +15,7 @@ #include "chrome/browser/ui/global_error_bubble_view_base.h" #include "chrome/browser/ui/global_error_service.h" #include "chrome/browser/ui/global_error_service_factory.h" +#include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -25,7 +27,12 @@ namespace protector { class ProtectorServiceTest : public InProcessBrowserTest { public: - virtual void SetUpOnMainThread() { + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + // Make sure protector is enabled. + command_line->AppendSwitch(switches::kProtector); + } + + virtual void SetUpOnMainThread() OVERRIDE { protector_service_ = ProtectorServiceFactory::GetForProfile(browser()->profile()); // ProtectService will own this change instance. diff --git a/chrome/browser/protector/protector_utils.cc b/chrome/browser/protector/protector_utils.cc index c8ffe61..80adc39 100644 --- a/chrome/browser/protector/protector_utils.cc +++ b/chrome/browser/protector/protector_utils.cc @@ -41,7 +41,7 @@ bool IsSettingValid(const std::string& value, const std::string& signature) { } bool IsEnabled() { - return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoProtector); + return CommandLine::ForCurrentProcess()->HasSwitch(switches::kProtector); } } // namespace protector diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 3716508..55ad7d18 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -1346,10 +1346,6 @@ void BrowserInit::LaunchWithProfile::AddBadFlagsInfoBarIfNecessary( switches::kSingleProcess, switches::kNoSandbox, switches::kInProcessWebGL, - // This should only be used for tests and to disable Protector on ChromeOS. -#if !defined(OS_CHROMEOS) - switches::kNoProtector, -#endif NULL }; diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 5fedf03..abe0d69d 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -896,9 +896,6 @@ const char kNoNetworkProfileWarning[] = "no-network-profile-warning"; // Don't send hyperlink auditing pings const char kNoPings[] = "no-pings"; -// Disables the Protector feature. -const char kNoProtector[] = "no-protector"; - // Don't use a proxy server, always make direct connections. Overrides any // other proxy server flags that are passed. const char kNoProxyServer[] = "no-proxy-server"; @@ -1045,6 +1042,9 @@ const char kProfilingFlush[] = "profiling-flush"; // Specifies a custom URL for fetching NTP promo data. const char kPromoServerURL[] = "promo-server-url"; +// Enables the Protector feature. +const char kProtector[] = "protector"; + // Forces proxy auto-detection. const char kProxyAutoDetect[] = "proxy-auto-detect"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index c616867..c600a9e 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -246,7 +246,6 @@ extern const char kNoManaged[]; extern const char kNoNetworkProfileWarning[]; extern const char kNoProxyServer[]; extern const char kNoPings[]; -extern const char kNoProtector[]; extern const char kNoRunningInsecureContent[]; extern const char kNoServiceAutorun[]; extern const char kNoStartupWindow[]; @@ -285,6 +284,7 @@ extern const char kProfilingFile[]; extern const char kProfilingFlush[]; extern const char kProfilingOutputFile[]; extern const char kPromoServerURL[]; +extern const char kProtector[]; extern const char kProxyAutoDetect[]; extern const char kProxyBypassList[]; extern const char kProxyPacUrl[]; diff --git a/chrome/test/functional/protector.py b/chrome/test/functional/protector.py index 2b9fab6..65cc394 100755 --- a/chrome/test/functional/protector.py +++ b/chrome/test/functional/protector.py @@ -34,6 +34,20 @@ class BaseProtectorTest(pyauto.PyUITest): # _GetDefaultSearchEngine call. self._new_default_search_keyword = None + def _IsEnabled(self): + """Whether protector should be enabled for the test suite.""" + return True + + def ExtraChromeFlags(self): + """Adds required Protector-related flags. + + Returns: + A list of extra flags to pass to Chrome when it is launched. + """ + return super(BaseProtectorTest, self).ExtraChromeFlags() + [ + '--protector' if self._IsEnabled() else '--no-protector' + ] + def _GetDefaultSearchEngine(self): """Returns the default search engine, if any; None otherwise. @@ -659,21 +673,9 @@ class ProtectorHomepageTest(BaseProtectorTest): class ProtectorDisabledTest(BaseProtectorTest): """Test suite for Protector in disabled state.""" - def ExtraChromeFlags(self): - """Ensures Protector is disabled. - - Returns: - A list of extra flags to pass to Chrome when it is launched. - """ - return super(ProtectorDisabledTest, self).ExtraChromeFlags() + [ - '--no-protector' - ] - - def testInfobarIsPresent(self): - """Verify that an infobar is present when running Chrome with --no-protector - flag. - """ - self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) + def _IsEnabled(self): + """Overriden from BaseProtectorTest to disable Protector.""" + return False def testNoSearchEngineChangeReported(self): """Test that the default search engine change is neither reported to user |