OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/policy/cloud/component_cloud_policy_service.h" | 5 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } // namespace | 100 } // namespace |
101 | 101 |
102 class ComponentCloudPolicyServiceTest : public testing::Test { | 102 class ComponentCloudPolicyServiceTest : public testing::Test { |
103 protected: | 103 protected: |
104 ComponentCloudPolicyServiceTest() | 104 ComponentCloudPolicyServiceTest() |
105 : ui_thread_(content::BrowserThread::UI, &loop_), | 105 : ui_thread_(content::BrowserThread::UI, &loop_), |
106 file_thread_(content::BrowserThread::FILE, &loop_) {} | 106 file_thread_(content::BrowserThread::FILE, &loop_) {} |
107 | 107 |
108 virtual void SetUp() OVERRIDE { | 108 virtual void SetUp() OVERRIDE { |
109 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 109 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
110 cache_ = new ResourceCache(temp_dir_.path()); | 110 cache_ = new ResourceCache(temp_dir_.path(), loop_.message_loop_proxy()); |
111 service_.reset(new ComponentCloudPolicyService( | 111 service_.reset(new ComponentCloudPolicyService( |
112 &delegate_, | 112 &delegate_, |
113 &store_, | 113 &store_, |
114 make_scoped_ptr(cache_), | 114 make_scoped_ptr(cache_), |
115 loop_.message_loop_proxy(), | 115 loop_.message_loop_proxy(), |
116 loop_.message_loop_proxy())); | 116 loop_.message_loop_proxy())); |
117 | 117 |
118 builder_.policy_data().set_policy_type( | 118 builder_.policy_data().set_policy_type( |
119 dm_protocol::kChromeExtensionPolicyType); | 119 dm_protocol::kChromeExtensionPolicyType); |
120 builder_.policy_data().set_settings_entity_id(kTestExtension); | 120 builder_.policy_data().set_settings_entity_id(kTestExtension); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 Mock::VerifyAndClearExpectations(&delegate_); | 518 Mock::VerifyAndClearExpectations(&delegate_); |
519 | 519 |
520 // The policy is now being served. | 520 // The policy is now being served. |
521 PolicyNamespace ns(POLICY_DOMAIN_EXTENSIONS, kTestExtension); | 521 PolicyNamespace ns(POLICY_DOMAIN_EXTENSIONS, kTestExtension); |
522 PolicyBundle expected_bundle; | 522 PolicyBundle expected_bundle; |
523 expected_bundle.Get(ns).CopyFrom(expected_policy_); | 523 expected_bundle.Get(ns).CopyFrom(expected_policy_); |
524 EXPECT_TRUE(service_->policy().Equals(expected_bundle)); | 524 EXPECT_TRUE(service_->policy().Equals(expected_bundle)); |
525 } | 525 } |
526 | 526 |
527 } // namespace policy | 527 } // namespace policy |
OLD | NEW |