OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
10 #include "base/scoped_temp_dir.h" | |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "chrome/browser/policy/cloud_policy_data_store.h" | 12 #include "chrome/browser/policy/cloud_policy_data_store.h" |
13 #include "chrome/browser/policy/cros_user_policy_cache.h" | 13 #include "chrome/browser/policy/cros_user_policy_cache.h" |
14 #include "chrome/browser/policy/proto/cloud_policy.pb.h" | 14 #include "chrome/browser/policy/proto/cloud_policy.pb.h" |
15 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 15 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
16 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 16 #include "chrome/browser/policy/proto/device_management_local.pb.h" |
17 #include "chromeos/dbus/mock_session_manager_client.h" | 17 #include "chromeos/dbus/mock_session_manager_client.h" |
18 #include "content/public/test/test_browser_thread.h" | 18 #include "content/public/test/test_browser_thread.h" |
19 #include "policy/policy_constants.h" | 19 #include "policy/policy_constants.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 MessageLoop loop_; | 95 MessageLoop loop_; |
96 | 96 |
97 chromeos::MockSessionManagerClient session_manager_client_; | 97 chromeos::MockSessionManagerClient session_manager_client_; |
98 scoped_ptr<CloudPolicyDataStore> data_store_; | 98 scoped_ptr<CloudPolicyDataStore> data_store_; |
99 | 99 |
100 private: | 100 private: |
101 content::TestBrowserThread ui_thread_; | 101 content::TestBrowserThread ui_thread_; |
102 content::TestBrowserThread file_thread_; | 102 content::TestBrowserThread file_thread_; |
103 ScopedTempDir tmp_dir_; | 103 base::ScopedTempDir tmp_dir_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(CrosUserPolicyCacheTest); | 105 DISALLOW_COPY_AND_ASSIGN(CrosUserPolicyCacheTest); |
106 }; | 106 }; |
107 | 107 |
108 TEST_F(CrosUserPolicyCacheTest, InitAndSetPolicy) { | 108 TEST_F(CrosUserPolicyCacheTest, InitAndSetPolicy) { |
109 CrosUserPolicyCache cache(&session_manager_client_, | 109 CrosUserPolicyCache cache(&session_manager_client_, |
110 data_store_.get(), | 110 data_store_.get(), |
111 false, | 111 false, |
112 token_file(), | 112 token_file(), |
113 policy_file()); | 113 policy_file()); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 EXPECT_EQ(kFakeDeviceId, data_store_->device_id()); | 181 EXPECT_EQ(kFakeDeviceId, data_store_->device_id()); |
182 EXPECT_EQ(kFakeToken, data_store_->device_token()); | 182 EXPECT_EQ(kFakeToken, data_store_->device_token()); |
183 EXPECT_EQ(1U, cache.policy()->size()); | 183 EXPECT_EQ(1U, cache.policy()->size()); |
184 const PolicyMap::Entry* entry = cache.policy()->Get(key::kShowHomeButton); | 184 const PolicyMap::Entry* entry = cache.policy()->Get(key::kShowHomeButton); |
185 ASSERT_TRUE(entry); | 185 ASSERT_TRUE(entry); |
186 EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value)); | 186 EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value)); |
187 }; | 187 }; |
188 | 188 |
189 } // namespace | 189 } // namespace |
190 } // namespace policy | 190 } // namespace policy |
OLD | NEW |