OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/policy/cloud_external_data_manager_base.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/message_loop/message_loop_proxy.h" | |
15 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
16 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
17 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
18 #include "base/test/test_simple_task_runner.h" | 17 #include "base/test/test_simple_task_runner.h" |
| 18 #include "base/thread_task_runner_handle.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/browser/chromeos/policy/cloud_external_data_store.h" | 20 #include "chrome/browser/chromeos/policy/cloud_external_data_store.h" |
21 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" | 21 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" |
22 #include "components/policy/core/common/cloud/resource_cache.h" | 22 #include "components/policy/core/common/cloud/resource_cache.h" |
23 #include "components/policy/core/common/external_data_fetcher.h" | 23 #include "components/policy/core/common/external_data_fetcher.h" |
24 #include "components/policy/core/common/policy_map.h" | 24 #include "components/policy/core/common/policy_map.h" |
25 #include "components/policy/core/common/policy_test_utils.h" | 25 #include "components/policy/core/common/policy_test_utils.h" |
26 #include "components/policy/core/common/policy_types.h" | 26 #include "components/policy/core/common/policy_types.h" |
27 #include "crypto/sha2.h" | 27 #include "crypto/sha2.h" |
28 #include "net/http/http_status_code.h" | 28 #include "net/http/http_status_code.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 k10BytePolicy, | 163 k10BytePolicy, |
164 ConstructMetadata(k10BytePolicyURL, | 164 ConstructMetadata(k10BytePolicyURL, |
165 crypto::SHA256HashString(k10ByteData))); | 165 crypto::SHA256HashString(k10ByteData))); |
166 // Make |k20BytePolicy| reference 20 bytes of external data. | 166 // Make |k20BytePolicy| reference 20 bytes of external data. |
167 SetExternalDataReference( | 167 SetExternalDataReference( |
168 k20BytePolicy, | 168 k20BytePolicy, |
169 ConstructMetadata(k20BytePolicyURL, | 169 ConstructMetadata(k20BytePolicyURL, |
170 crypto::SHA256HashString(k20ByteData))); | 170 crypto::SHA256HashString(k20ByteData))); |
171 cloud_policy_store_.NotifyStoreLoaded(); | 171 cloud_policy_store_.NotifyStoreLoaded(); |
172 | 172 |
173 request_content_getter_ = new net::TestURLRequestContextGetter( | 173 request_content_getter_ = |
174 base::MessageLoopProxy::current()); | 174 new net::TestURLRequestContextGetter(base::ThreadTaskRunnerHandle::Get()); |
175 | 175 |
176 policy_details_.SetDetails(kStringPolicy, &kPolicyDetails[0]); | 176 policy_details_.SetDetails(kStringPolicy, &kPolicyDetails[0]); |
177 policy_details_.SetDetails(k10BytePolicy, &kPolicyDetails[1]); | 177 policy_details_.SetDetails(k10BytePolicy, &kPolicyDetails[1]); |
178 policy_details_.SetDetails(k20BytePolicy, &kPolicyDetails[2]); | 178 policy_details_.SetDetails(k20BytePolicy, &kPolicyDetails[2]); |
179 } | 179 } |
180 | 180 |
181 void CloudExternalDataManagerBaseTest::TearDown() { | 181 void CloudExternalDataManagerBaseTest::TearDown() { |
182 external_data_manager_.reset(); | 182 external_data_manager_.reset(); |
183 base::RunLoop().RunUntilIdle(); | 183 base::RunLoop().RunUntilIdle(); |
184 ResetCallbackData(); | 184 ResetCallbackData(); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 crypto::SHA256HashString(k10ByteData))); | 771 crypto::SHA256HashString(k10ByteData))); |
772 cloud_policy_store_.NotifyStoreLoaded(); | 772 cloud_policy_store_.NotifyStoreLoaded(); |
773 base::RunLoop().RunUntilIdle(); | 773 base::RunLoop().RunUntilIdle(); |
774 EXPECT_EQ(1u, callback_data_.size()); | 774 EXPECT_EQ(1u, callback_data_.size()); |
775 ASSERT_TRUE(callback_data_[1]); | 775 ASSERT_TRUE(callback_data_[1]); |
776 EXPECT_EQ(k10ByteData, *callback_data_[1]); | 776 EXPECT_EQ(k10ByteData, *callback_data_[1]); |
777 ResetCallbackData(); | 777 ResetCallbackData(); |
778 } | 778 } |
779 | 779 |
780 } // namespace policy | 780 } // namespace policy |
OLD | NEW |