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

Unified Diff: chrome/browser/policy/device_policy_cache_unittest.cc

Issue 9111022: Removed ConfigurationPolicyType and extended PolicyMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed builds, rebased Created 8 years, 11 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
Index: chrome/browser/policy/device_policy_cache_unittest.cc
diff --git a/chrome/browser/policy/device_policy_cache_unittest.cc b/chrome/browser/policy/device_policy_cache_unittest.cc
index d97a69d52ea0838362dd672aa56323ddb3e445b7..dfdc1569d78272d08f0e8193c42513aa0772f394 100644
--- a/chrome/browser/policy/device_policy_cache_unittest.cc
+++ b/chrome/browser/policy/device_policy_cache_unittest.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/policy/cloud_policy_data_store.h"
#include "chrome/browser/policy/enterprise_install_attributes.h"
#include "content/test/test_browser_thread.h"
-#include "policy/configuration_policy_type.h"
+#include "policy/policy_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -30,7 +30,7 @@ void CreatePolicy(em::PolicyFetchResponse* policy,
const std::string& user,
em::ChromeDeviceSettingsProto& settings) {
// This method omits a few fields which currently aren't needed by tests:
- // timestamp, machine_name, policy_type, public key info.
+ // timestamp, machine_name, public key info.
em::PolicyData signed_response;
signed_response.set_username(user);
signed_response.set_request_token("dmtoken");
@@ -94,12 +94,8 @@ class DevicePolicyCacheTest : public testing::Test {
install_attributes_.LockDevice(registration_user));
}
- const Value* GetMandatoryPolicy(ConfigurationPolicyType policy) {
- return cache_->mandatory_policy_.Get(policy);
- }
-
- const Value* GetRecommendedPolicy(ConfigurationPolicyType policy) {
- return cache_->recommended_policy_.Get(policy);
+ const Value* GetPolicy(const char* policy_name) {
+ return cache_->policy()->GetValue(policy_name);
}
scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_;
@@ -126,8 +122,7 @@ TEST_F(DevicePolicyCacheTest, Startup) {
testing::Mock::VerifyAndClearExpectations(&signed_settings_helper_);
base::FundamentalValue expected(120);
EXPECT_TRUE(Value::Equals(&expected,
- GetMandatoryPolicy(
- kPolicyDevicePolicyRefreshRate)));
+ GetPolicy(key::kDevicePolicyRefreshRate)));
}
TEST_F(DevicePolicyCacheTest, SetPolicy) {
@@ -145,8 +140,7 @@ TEST_F(DevicePolicyCacheTest, SetPolicy) {
testing::Mock::VerifyAndClearExpectations(&signed_settings_helper_);
base::FundamentalValue expected(120);
EXPECT_TRUE(Value::Equals(&expected,
- GetMandatoryPolicy(
- kPolicyDevicePolicyRefreshRate)));
+ GetPolicy(key::kDevicePolicyRefreshRate)));
// Set new policy information.
em::PolicyFetchResponse new_policy;
@@ -160,8 +154,7 @@ TEST_F(DevicePolicyCacheTest, SetPolicy) {
testing::Mock::VerifyAndClearExpectations(&signed_settings_helper_);
base::FundamentalValue updated_expected(300);
EXPECT_TRUE(Value::Equals(&updated_expected,
- GetMandatoryPolicy(
- kPolicyDevicePolicyRefreshRate)));
+ GetPolicy(key::kDevicePolicyRefreshRate)));
}
TEST_F(DevicePolicyCacheTest, SetPolicyWrongUser) {
@@ -187,8 +180,7 @@ TEST_F(DevicePolicyCacheTest, SetPolicyWrongUser) {
base::FundamentalValue expected(120);
EXPECT_TRUE(Value::Equals(&expected,
- GetMandatoryPolicy(
- kPolicyDevicePolicyRefreshRate)));
+ GetPolicy(key::kDevicePolicyRefreshRate)));
}
TEST_F(DevicePolicyCacheTest, SetPolicyNonEnterpriseDevice) {
@@ -212,8 +204,7 @@ TEST_F(DevicePolicyCacheTest, SetPolicyNonEnterpriseDevice) {
base::FundamentalValue expected(120);
EXPECT_TRUE(Value::Equals(&expected,
- GetMandatoryPolicy(
- kPolicyDevicePolicyRefreshRate)));
+ GetPolicy(key::kDevicePolicyRefreshRate)));
}
TEST_F(DevicePolicyCacheTest, SetProxyPolicy) {
@@ -233,13 +224,13 @@ TEST_F(DevicePolicyCacheTest, SetProxyPolicy) {
StringValue expected_proxy_pac_url("http://proxy:8080/pac.js");
StringValue expected_proxy_bypass_list("127.0.0.1,example.com");
EXPECT_TRUE(Value::Equals(&expected_proxy_mode,
- GetRecommendedPolicy(kPolicyProxyMode)));
+ GetPolicy(key::kProxyMode)));
EXPECT_TRUE(Value::Equals(&expected_proxy_server,
- GetRecommendedPolicy(kPolicyProxyServer)));
+ GetPolicy(key::kProxyServer)));
EXPECT_TRUE(Value::Equals(&expected_proxy_pac_url,
- GetRecommendedPolicy(kPolicyProxyPacUrl)));
+ GetPolicy(key::kProxyPacUrl)));
EXPECT_TRUE(Value::Equals(&expected_proxy_bypass_list,
- GetRecommendedPolicy(kPolicyProxyBypassList)));
+ GetPolicy(key::kProxyBypassList)));
}
TEST_F(DevicePolicyCacheTest, SetDeviceNetworkConfigurationPolicy) {
@@ -260,7 +251,7 @@ TEST_F(DevicePolicyCacheTest, SetDeviceNetworkConfigurationPolicy) {
StringValue expected_config(fake_config);
EXPECT_TRUE(
Value::Equals(&expected_config,
- GetMandatoryPolicy(kPolicyDeviceOpenNetworkConfiguration)));
+ GetPolicy(key::kDeviceOpenNetworkConfiguration)));
}
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698