diff options
Diffstat (limited to 'chrome/browser/policy')
9 files changed, 136 insertions, 49 deletions
diff --git a/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc b/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc index 269ca75..9f3c403 100644 --- a/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc @@ -127,7 +127,7 @@ TEST_F(CloudPolicyRefreshSchedulerTest, InitialRefreshManagedAlreadyFetched) { } TEST_F(CloudPolicyRefreshSchedulerTest, Unregistered) { - client_.SetDMToken(""); + client_.SetDMToken(std::string()); scoped_ptr<CloudPolicyRefreshScheduler> scheduler(CreateRefreshScheduler()); client_.NotifyPolicyFetched(); client_.NotifyRegistrationStateChanged(); @@ -182,7 +182,7 @@ TEST_F(CloudPolicyRefreshSchedulerSteadyStateTest, OnRegistrationStateChanged) { EXPECT_EQ(GetLastDelay(), base::TimeDelta()); task_runner_->ClearPendingTasks(); - client_.SetDMToken(""); + client_.SetDMToken(std::string()); client_.NotifyRegistrationStateChanged(); EXPECT_TRUE(task_runner_->GetPendingTasks().empty()); } diff --git a/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc b/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc index 90b344b..b1c7ccb 100644 --- a/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc @@ -118,7 +118,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicySuccess) { TEST_F(CloudPolicyServiceTest, RefreshPolicyNotRegistered) { // Clear the token so the client is not registered. - client_.SetDMToken(""); + client_.SetDMToken(std::string()); EXPECT_CALL(client_, FetchPolicy()).Times(0); EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1); diff --git a/chrome/browser/policy/cloud/device_management_service_unittest.cc b/chrome/browser/policy/cloud/device_management_service_unittest.cc index ae84965..b83ca80 100644 --- a/chrome/browser/policy/cloud/device_management_service_unittest.cc +++ b/chrome/browser/policy/cloud/device_management_service_unittest.cc @@ -513,7 +513,7 @@ TEST_F(DeviceManagementServiceTest, CancelDuringCallback) { // Generate a callback. net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); - SendResponse(fetcher, status, 500, ""); + SendResponse(fetcher, status, 500, std::string()); // Job should have been reset. EXPECT_FALSE(request_job.get()); @@ -534,7 +534,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnProxyError) { // Generate a callback with a proxy failure. net::URLRequestStatus status(net::URLRequestStatus::FAILED, net::ERR_PROXY_CONNECTION_FAILED); - SendResponse(fetcher, status, 200, ""); + SendResponse(fetcher, status, 200, std::string()); // Verify that a new URLFetcher was started that bypasses the proxy. fetcher = GetFetcher(); @@ -564,7 +564,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnBadResponseFromProxy) { // Generate a callback with a valid http response, that was generated by // a bad/wrong proxy. net::URLRequestStatus status; - SendResponse(fetcher, status, 200, ""); + SendResponse(fetcher, status, 200, std::string()); // Verify that a new URLFetcher was started that bypasses the proxy. fetcher = GetFetcher(); diff --git a/chrome/browser/policy/cloud/mock_cloud_policy_client.cc b/chrome/browser/policy/cloud/mock_cloud_policy_client.cc index 7008ec3..92b67e7 100644 --- a/chrome/browser/policy/cloud/mock_cloud_policy_client.cc +++ b/chrome/browser/policy/cloud/mock_cloud_policy_client.cc @@ -10,7 +10,11 @@ namespace em = enterprise_management; namespace policy { MockCloudPolicyClient::MockCloudPolicyClient() - : CloudPolicyClient("", "", USER_AFFILIATION_NONE, NULL, NULL) {} + : CloudPolicyClient(std::string(), + std::string(), + USER_AFFILIATION_NONE, + NULL, + NULL) {} MockCloudPolicyClient::~MockCloudPolicyClient() {} diff --git a/chrome/browser/policy/cloud/mock_device_management_service.cc b/chrome/browser/policy/cloud/mock_device_management_service.cc index 987cf62..f7836ce 100644 --- a/chrome/browser/policy/cloud/mock_device_management_service.cc +++ b/chrome/browser/policy/cloud/mock_device_management_service.cc @@ -116,7 +116,7 @@ ACTION_P2(CreateAsyncMockDeviceManagementJob, service, mock_job) { MockDeviceManagementJob::~MockDeviceManagementJob() {} MockDeviceManagementService::MockDeviceManagementService() - : DeviceManagementService("") {} + : DeviceManagementService(std::string()) {} MockDeviceManagementService::~MockDeviceManagementService() {} diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index a801f83..321b3732 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -409,9 +409,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptions) { ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs( - "chromium.org", "", "http://chromium.org/override", - ProxyPrefs::MODE_FIXED_SERVERS); + VerifyProxyPrefs("chromium.org", + std::string(), + "http://chromium.org/override", + ProxyPrefs::MODE_FIXED_SERVERS); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsReversedApplyOrder) { @@ -426,9 +427,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsReversedApplyOrder) { base::Value::CreateStringValue("chromium.org")); UpdateProviderPolicy(policy); - VerifyProxyPrefs( - "chromium.org", "", "http://chromium.org/override", - ProxyPrefs::MODE_FIXED_SERVERS); + VerifyProxyPrefs("chromium.org", + std::string(), + "http://chromium.org/override", + ProxyPrefs::MODE_FIXED_SERVERS); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsInvalid) { @@ -450,7 +452,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_DIRECT); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyModeName) { @@ -458,7 +461,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyModeName) { policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue(ProxyPrefs::kDirectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_DIRECT); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyServerMode) { @@ -468,7 +472,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_AUTO_DETECT_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyModeName) { @@ -477,7 +484,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyModeName) { base::Value::CreateStringValue( ProxyPrefs::kAutoDetectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyMode) { @@ -488,7 +498,9 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyMode) { base::Value::CreateStringValue( ProxyPrefs::kPacScriptProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "http://short.org/proxy.pac", "", + VerifyProxyPrefs(std::string(), + "http://short.org/proxy.pac", + std::string(), ProxyPrefs::MODE_PAC_SCRIPT); } @@ -506,15 +518,21 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeInvalid) { // for unset properties. TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeBug78016) { PolicyMap policy; - policy.Set(key::kProxyServer, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - base::Value::CreateStringValue("")); - policy.Set(key::kProxyPacUrl, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + policy.Set(key::kProxyServer, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + base::Value::CreateStringValue(std::string())); + policy.Set(key::kProxyPacUrl, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, base::Value::CreateStringValue("http://short.org/proxy.pac")); policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue( ProxyPrefs::kPacScriptProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "http://short.org/proxy.pac", "", + VerifyProxyPrefs(std::string(), + "http://short.org/proxy.pac", + std::string(), ProxyPrefs::MODE_PAC_SCRIPT); } @@ -524,7 +542,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_USE_SYSTEM_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_SYSTEM); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyMode) { @@ -532,7 +551,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyMode) { policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue(ProxyPrefs::kSystemProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_SYSTEM); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, @@ -545,7 +565,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, base::Value::CreateStringValue( ProxyPrefs::kAutoDetectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ProxyInvalid) { @@ -768,7 +791,7 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Disabled) { base::FundamentalValue expected_enabled(false); EXPECT_TRUE(base::Value::Equals(&expected_enabled, value)); EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value)); - base::StringValue expected_search_url(""); + base::StringValue expected_search_url((std::string())); EXPECT_TRUE(base::Value::Equals(&expected_search_url, value)); } @@ -908,8 +931,10 @@ TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, Default) { TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, SetDownloadDirectory) { PolicyMap policy; EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL)); - policy.Set(key::kDownloadDirectory, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_USER, base::Value::CreateStringValue("")); + policy.Set(key::kDownloadDirectory, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + base::Value::CreateStringValue(std::string())); UpdateProviderPolicy(policy); // Setting a DownloadDirectory should disable the PromptForDownload pref. diff --git a/chrome/browser/policy/policy_map_unittest.cc b/chrome/browser/policy/policy_map_unittest.cc index a2f6207..367ce06 100644 --- a/chrome/browser/policy/policy_map_unittest.cc +++ b/chrome/browser/policy/policy_map_unittest.cc @@ -103,9 +103,13 @@ TEST(PolicyMapTest, MergeFrom) { Value::CreateBooleanValue(false)); b.Set(key::kBookmarkBarEnabled, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, Value::CreateBooleanValue(true)); - b.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, Value::CreateStringValue("")); - b.Set(key::kDisableSpdy, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + b.Set(key::kDefaultSearchProviderSearchURL, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, + Value::CreateStringValue(std::string())); + b.Set(key::kDisableSpdy, + POLICY_LEVEL_RECOMMENDED, + POLICY_SCOPE_USER, Value::CreateBooleanValue(true)); a.MergeFrom(b); @@ -121,8 +125,10 @@ TEST(PolicyMapTest, MergeFrom) { c.Set(key::kBookmarkBarEnabled, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, Value::CreateBooleanValue(true)); // POLICY_LEVEL_MANDATORY over POLICY_LEVEL_RECOMMENDED. - c.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, Value::CreateStringValue("")); + c.Set(key::kDefaultSearchProviderSearchURL, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, + Value::CreateStringValue(std::string())); // Merge new ones. c.Set(key::kDisableSpdy, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, Value::CreateBooleanValue(true)); diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index bce4fe0..23173bc 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -519,8 +519,8 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) { // set by policy. PolicyMap policies; UpdateProviderPolicy(policies); - VerifyControlledSettingIndicators(browser(), indicator_selector, - "", "", false); + VerifyControlledSettingIndicators( + browser(), indicator_selector, std::string(), std::string(), false); // Check that the appropriate controlled setting indicator is shown when a // value is enforced by policy. policies.LoadFrom(&(*indicator_test_case)->policy(), diff --git a/chrome/browser/policy/url_blacklist_manager_unittest.cc b/chrome/browser/policy/url_blacklist_manager_unittest.cc index 3e5ac0f..b1f69d1 100644 --- a/chrome/browser/policy/url_blacklist_manager_unittest.cc +++ b/chrome/browser/policy/url_blacklist_manager_unittest.cc @@ -240,31 +240,83 @@ INSTANTIATE_TEST_CASE_P( URLBlacklistFilterToComponentsTest, testing::Values( FilterTestParams("google.com", - "", ".google.com", true, 0u, ""), + std::string(), + ".google.com", + true, + 0u, + std::string()), FilterTestParams(".google.com", - "", "google.com", false, 0u, ""), + std::string(), + "google.com", + false, + 0u, + std::string()), FilterTestParams("http://google.com", - "http", ".google.com", true, 0u, ""), + "http", + ".google.com", + true, + 0u, + std::string()), FilterTestParams("google.com/", - "", ".google.com", true, 0u, "/"), + std::string(), + ".google.com", + true, + 0u, + "/"), FilterTestParams("http://google.com:8080/whatever", - "http", ".google.com", true, 8080u, "/whatever"), + "http", + ".google.com", + true, + 8080u, + "/whatever"), FilterTestParams("http://user:pass@google.com:8080/whatever", - "http", ".google.com", true, 8080u, "/whatever"), + "http", + ".google.com", + true, + 8080u, + "/whatever"), FilterTestParams("123.123.123.123", - "", "123.123.123.123", false, 0u, ""), + std::string(), + "123.123.123.123", + false, + 0u, + std::string()), FilterTestParams("https://123.123.123.123", - "https", "123.123.123.123", false, 0u, ""), + "https", + "123.123.123.123", + false, + 0u, + std::string()), FilterTestParams("123.123.123.123/", - "", "123.123.123.123", false, 0u, "/"), + std::string(), + "123.123.123.123", + false, + 0u, + "/"), FilterTestParams("http://123.123.123.123:123/whatever", - "http", "123.123.123.123", false, 123u, "/whatever"), + "http", + "123.123.123.123", + false, + 123u, + "/whatever"), FilterTestParams("*", - "", "", true, 0u, ""), + std::string(), + std::string(), + true, + 0u, + std::string()), FilterTestParams("ftp://*", - "ftp", "", true, 0u, ""), + "ftp", + std::string(), + true, + 0u, + std::string()), FilterTestParams("http://*/whatever", - "http", "", true, 0u, "/whatever"))); + "http", + std::string(), + true, + 0u, + "/whatever"))); TEST_F(URLBlacklistManagerTest, Filtering) { URLBlacklist blacklist; |