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" |
11 #include "policy/configuration_policy_type.h" | 12 #include "policy/configuration_policy_type.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 namespace policy { | 16 namespace policy { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 // Test registration user name. | 20 // Test registration user name. |
20 const char kTestUser[] = "test@example.com"; | 21 const char kTestUser[] = "test@example.com"; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 signed_response.set_device_id("deviceid"); | 63 signed_response.set_device_id("deviceid"); |
63 EXPECT_TRUE( | 64 EXPECT_TRUE( |
64 settings.SerializeToString(signed_response.mutable_policy_value())); | 65 settings.SerializeToString(signed_response.mutable_policy_value())); |
65 std::string serialized_signed_response; | 66 std::string serialized_signed_response; |
66 EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response)); | 67 EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response)); |
67 policy->set_policy_data(serialized_signed_response); | 68 policy->set_policy_data(serialized_signed_response); |
68 } | 69 } |
69 | 70 |
70 } // namespace | 71 } // namespace |
71 | 72 |
72 class DevicePolicyCacheTest : public testing::Test { | 73 class DevicePolicyCacheTest : public TestingBrowserProcessTest { |
73 protected: | 74 protected: |
74 DevicePolicyCacheTest() | 75 DevicePolicyCacheTest() |
75 : cryptohome_(chromeos::CryptohomeLibrary::GetImpl(true)), | 76 : cryptohome_(chromeos::CryptohomeLibrary::GetImpl(true)), |
76 install_attributes_(cryptohome_.get()) {} | 77 install_attributes_(cryptohome_.get()) {} |
77 | 78 |
78 virtual void SetUp() { | 79 virtual void SetUp() { |
79 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); | 80 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); |
80 cache_.reset(new DevicePolicyCache(data_store_.get(), | 81 cache_.reset(new DevicePolicyCache(data_store_.get(), |
81 &install_attributes_, | 82 &install_attributes_, |
82 &signed_settings_helper_)); | 83 &signed_settings_helper_)); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 GetRecommendedPolicy(kPolicyProxyMode))); | 234 GetRecommendedPolicy(kPolicyProxyMode))); |
234 EXPECT_TRUE(Value::Equals(&expected_proxy_server, | 235 EXPECT_TRUE(Value::Equals(&expected_proxy_server, |
235 GetRecommendedPolicy(kPolicyProxyServer))); | 236 GetRecommendedPolicy(kPolicyProxyServer))); |
236 EXPECT_TRUE(Value::Equals(&expected_proxy_pac_url, | 237 EXPECT_TRUE(Value::Equals(&expected_proxy_pac_url, |
237 GetRecommendedPolicy(kPolicyProxyPacUrl))); | 238 GetRecommendedPolicy(kPolicyProxyPacUrl))); |
238 EXPECT_TRUE(Value::Equals(&expected_proxy_bypass_list, | 239 EXPECT_TRUE(Value::Equals(&expected_proxy_bypass_list, |
239 GetRecommendedPolicy(kPolicyProxyBypassList))); | 240 GetRecommendedPolicy(kPolicyProxyBypassList))); |
240 } | 241 } |
241 | 242 |
242 } // namespace policy | 243 } // namespace policy |
OLD | NEW |