OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/policy/device_policy_cache.h" | 5 #include "chrome/browser/policy/device_policy_cache.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 7 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
8 #include "chrome/browser/chromeos/login/mock_signed_settings_helper.h" | 8 #include "chrome/browser/chromeos/login/mock_signed_settings_helper.h" |
9 #include "chrome/browser/policy/cloud_policy_data_store.h" | 9 #include "chrome/browser/policy/cloud_policy_data_store.h" |
10 #include "chrome/browser/policy/enterprise_install_attributes.h" | 10 #include "chrome/browser/policy/enterprise_install_attributes.h" |
11 #include "chrome/test/base/testing_browser_process_test.h" | |
12 #include "policy/configuration_policy_type.h" | 11 #include "policy/configuration_policy_type.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
15 | 14 |
16 namespace policy { | 15 namespace policy { |
17 | 16 |
18 namespace { | 17 namespace { |
19 | 18 |
20 // Test registration user name. | 19 // Test registration user name. |
21 const char kTestUser[] = "test@example.com"; | 20 const char kTestUser[] = "test@example.com"; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 signed_response.set_device_id("deviceid"); | 62 signed_response.set_device_id("deviceid"); |
64 EXPECT_TRUE( | 63 EXPECT_TRUE( |
65 settings.SerializeToString(signed_response.mutable_policy_value())); | 64 settings.SerializeToString(signed_response.mutable_policy_value())); |
66 std::string serialized_signed_response; | 65 std::string serialized_signed_response; |
67 EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response)); | 66 EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response)); |
68 policy->set_policy_data(serialized_signed_response); | 67 policy->set_policy_data(serialized_signed_response); |
69 } | 68 } |
70 | 69 |
71 } // namespace | 70 } // namespace |
72 | 71 |
73 class DevicePolicyCacheTest : public TestingBrowserProcessTest { | 72 class DevicePolicyCacheTest : public testing::Test { |
74 protected: | 73 protected: |
75 DevicePolicyCacheTest() | 74 DevicePolicyCacheTest() |
76 : cryptohome_(chromeos::CryptohomeLibrary::GetImpl(true)), | 75 : cryptohome_(chromeos::CryptohomeLibrary::GetImpl(true)), |
77 install_attributes_(cryptohome_.get()) {} | 76 install_attributes_(cryptohome_.get()) {} |
78 | 77 |
79 virtual void SetUp() { | 78 virtual void SetUp() { |
80 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); | 79 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); |
81 cache_.reset(new DevicePolicyCache(data_store_.get(), | 80 cache_.reset(new DevicePolicyCache(data_store_.get(), |
82 &install_attributes_, | 81 &install_attributes_, |
83 &signed_settings_helper_)); | 82 &signed_settings_helper_)); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 GetRecommendedPolicy(kPolicyProxyMode))); | 233 GetRecommendedPolicy(kPolicyProxyMode))); |
235 EXPECT_TRUE(Value::Equals(&expected_proxy_server, | 234 EXPECT_TRUE(Value::Equals(&expected_proxy_server, |
236 GetRecommendedPolicy(kPolicyProxyServer))); | 235 GetRecommendedPolicy(kPolicyProxyServer))); |
237 EXPECT_TRUE(Value::Equals(&expected_proxy_pac_url, | 236 EXPECT_TRUE(Value::Equals(&expected_proxy_pac_url, |
238 GetRecommendedPolicy(kPolicyProxyPacUrl))); | 237 GetRecommendedPolicy(kPolicyProxyPacUrl))); |
239 EXPECT_TRUE(Value::Equals(&expected_proxy_bypass_list, | 238 EXPECT_TRUE(Value::Equals(&expected_proxy_bypass_list, |
240 GetRecommendedPolicy(kPolicyProxyBypassList))); | 239 GetRecommendedPolicy(kPolicyProxyBypassList))); |
241 } | 240 } |
242 | 241 |
243 } // namespace policy | 242 } // namespace policy |
OLD | NEW |