Chromium Code Reviews| Index: chrome/browser/policy/policy_browsertest.cc |
| diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc |
| index b7eae5b09e3c2d98db01f0ecb4b6be7d62967773..bda21fb58d29b34dea7000f6210a0db27d35cfd2 100644 |
| --- a/chrome/browser/policy/policy_browsertest.cc |
| +++ b/chrome/browser/policy/policy_browsertest.cc |
| @@ -4359,153 +4359,6 @@ IN_PROC_BROWSER_TEST_F(ArcPolicyTest, ArcLocationServiceEnabled) { |
| } |
| } |
| -namespace { |
| -const char kTestUser1[] = "test1@domain.com"; |
| -} // anonymous namespace |
| - |
| -class ChromeOSPolicyTest : public PolicyTest { |
| - public: |
| - ChromeOSPolicyTest() {} |
| - |
| - void SetUpCommandLine(base::CommandLine* command_line) override { |
| - PolicyTest::SetUpCommandLine(command_line); |
| - command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
| - cryptohome_id1_.id()); |
| - command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "hash"); |
| - command_line->AppendSwitch( |
| - chromeos::switches::kAllowFailedPolicyFetchForTest); |
| - } |
| - |
| - protected: |
| - const AccountId test_account_id1_ = AccountId::FromUserEmail(kTestUser1); |
| - const cryptohome::Identification cryptohome_id1_ = |
| - cryptohome::Identification(test_account_id1_); |
| - |
| - // Logs in |account_id|. |
| - void LogIn(const AccountId& account_id, const std::string& user_id_hash) { |
| - user_manager::UserManager::Get()->UserLoggedIn(account_id, user_id_hash, |
| - false); |
| - base::RunLoop().RunUntilIdle(); |
| - } |
| - |
| - void NavigateToUrl(const GURL& url) { |
| - ui_test_utils::NavigateToURL(browser(), url); |
| - base::RunLoop().RunUntilIdle(); |
| - } |
| - |
| - void CheckSystemTimezoneAutomaticDetectionPolicyUnset() { |
| - PrefService* local_state = g_browser_process->local_state(); |
| - EXPECT_FALSE(local_state->IsManagedPreference( |
| - prefs::kSystemTimezoneAutomaticDetectionPolicy)); |
| - EXPECT_EQ(0, local_state->GetInteger( |
| - prefs::kSystemTimezoneAutomaticDetectionPolicy)); |
| - } |
| - |
| - void SetAndTestSystemTimezoneAutomaticDetectionPolicy(int policy_value) { |
| - PolicyMap policies; |
| - policies.Set(key::kSystemTimezoneAutomaticDetection, POLICY_LEVEL_MANDATORY, |
| - POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, |
| - base::MakeUnique<base::Value>(policy_value), nullptr); |
| - UpdateProviderPolicy(policies); |
| - |
| - PrefService* local_state = g_browser_process->local_state(); |
| - |
| - EXPECT_TRUE(local_state->IsManagedPreference( |
| - prefs::kSystemTimezoneAutomaticDetectionPolicy)); |
| - EXPECT_EQ(policy_value, |
| - local_state->GetInteger( |
| - prefs::kSystemTimezoneAutomaticDetectionPolicy)); |
| - } |
| - |
| - void SetEmptyPolicy() { UpdateProviderPolicy(PolicyMap()); } |
| - |
| - bool CheckResolveTimezoneByGeolocation(bool checked, bool disabled) { |
| - checker.set_web_contents( |
| - browser()->tab_strip_model()->GetActiveWebContents()); |
| - const std::string expression = base::StringPrintf( |
| - "(function () {\n" |
|
dpapad
2017/06/01 00:12:54
I am so glad we are removing this kind of tests.
Dan Beam
2017/06/03 00:11:02
i think the idea of the test is noble. the implem
|
| - " var checkbox = " |
| - "document.getElementById('resolve-timezone-by-geolocation');\n" |
| - " if (!checkbox) {\n" |
| - " console.log('resolve-timezone-by-geolocation not found.');\n" |
| - " return false;\n" |
| - " }\n" |
| - " var expected_checked = %s;\n" |
| - " var expected_disabled = %s;\n" |
| - " var checked = checkbox.checked;\n" |
| - " var disabled = checkbox.disabled;\n" |
| - " if (checked != expected_checked)\n" |
| - " console.log('ERROR: expected_checked=' + expected_checked + ' != " |
| - "checked=' + checked);\n" |
| - "\n" |
| - " if (disabled != expected_disabled)\n" |
| - " console.log('ERROR: expected_disabled=' + expected_disabled + ' " |
| - "!= disabled=' + disabled);\n" |
| - "\n" |
| - " return (checked == expected_checked && disabled == " |
| - "expected_disabled);\n" |
| - "})()", |
| - checked ? "true" : "false", disabled ? "true" : "false"); |
| - return checker.GetBool(expression); |
| - } |
| - |
| - private: |
| - chromeos::test::JSChecker checker; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(ChromeOSPolicyTest); |
| -}; |
| - |
| -IN_PROC_BROWSER_TEST_F(ChromeOSPolicyTest, SystemTimezoneAutomaticDetection) { |
| - base::test::ScopedFeatureList disable_md_settings; |
| - disable_md_settings.InitAndDisableFeature(features::kMaterialDesignSettings); |
| - |
| - ui_test_utils::NavigateToURL(browser(), GURL("chrome://settings")); |
| - chromeos::system::TimeZoneResolverManager* manager = |
| - g_browser_process->platform_part()->GetTimezoneResolverManager(); |
| - |
| - // Policy not set. |
| - CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
| - EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| - EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| - |
| - int policy_value = 0 /* USERS_DECIDE */; |
| - SetAndTestSystemTimezoneAutomaticDetectionPolicy(policy_value); |
| - EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| - EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| - |
| - policy_value = 1 /* DISABLED */; |
| - SetAndTestSystemTimezoneAutomaticDetectionPolicy(policy_value); |
| - EXPECT_TRUE(CheckResolveTimezoneByGeolocation(false, true)); |
| - EXPECT_FALSE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| - |
| - policy_value = 2 /* IP_ONLY */; |
| - SetAndTestSystemTimezoneAutomaticDetectionPolicy(policy_value); |
| - EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, true)); |
| - EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| - |
| - policy_value = 3 /* SEND_WIFI_ACCESS_POINTS */; |
| - SetAndTestSystemTimezoneAutomaticDetectionPolicy(policy_value); |
| - EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, true)); |
| - EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| - |
| - policy_value = 4 /* SEND_ALL_LOCATION_INFO */; |
| - SetAndTestSystemTimezoneAutomaticDetectionPolicy(policy_value); |
| - EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, true)); |
| - EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| - |
| - policy_value = 1 /* DISABLED */; |
| - SetAndTestSystemTimezoneAutomaticDetectionPolicy(policy_value); |
| - EXPECT_TRUE(CheckResolveTimezoneByGeolocation(false, true)); |
| - EXPECT_FALSE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| - |
| - SetEmptyPolicy(); |
| - // Policy not set. |
| - CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
| - EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| - EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| -} |
| -#endif // defined(OS_CHROMEOS) |
| - |
| class NetworkTimePolicyTest : public PolicyTest { |
| public: |
| void SetUpCommandLine(base::CommandLine* command_line) override { |