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 "components/policy/core/common/configuration_policy_provider_test.h" | 5 #include "components/policy/core/common/configuration_policy_provider_test.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop/message_loop_proxy.h" | |
10 #include "base/values.h" | 9 #include "base/values.h" |
11 #include "components/policy/core/common/configuration_policy_provider.h" | 10 #include "components/policy/core/common/configuration_policy_provider.h" |
12 #include "components/policy/core/common/external_data_fetcher.h" | 11 #include "components/policy/core/common/external_data_fetcher.h" |
13 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 12 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
14 #include "components/policy/core/common/policy_bundle.h" | 13 #include "components/policy/core/common/policy_bundle.h" |
15 #include "components/policy/core/common/policy_map.h" | 14 #include "components/policy/core/common/policy_map.h" |
16 #include "components/policy/core/common/policy_namespace.h" | 15 #include "components/policy/core/common/policy_namespace.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
18 | 17 |
19 using ::testing::Mock; | 18 using ::testing::Mock; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 extension_schema); | 185 extension_schema); |
187 schema_registry_.RegisterComponent( | 186 schema_registry_.RegisterComponent( |
188 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, | 187 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, |
189 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"), | 188 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"), |
190 extension_schema); | 189 extension_schema); |
191 schema_registry_.RegisterComponent( | 190 schema_registry_.RegisterComponent( |
192 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, | 191 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, |
193 "cccccccccccccccccccccccccccccccc"), | 192 "cccccccccccccccccccccccccccccccc"), |
194 extension_schema); | 193 extension_schema); |
195 | 194 |
196 provider_.reset(test_harness_->CreateProvider(&schema_registry_, | 195 provider_.reset( |
197 loop_.message_loop_proxy())); | 196 test_harness_->CreateProvider(&schema_registry_, loop_.task_runner())); |
198 provider_->Init(&schema_registry_); | 197 provider_->Init(&schema_registry_); |
199 // Some providers do a reload on init. Make sure any notifications generated | 198 // Some providers do a reload on init. Make sure any notifications generated |
200 // are fired now. | 199 // are fired now. |
201 loop_.RunUntilIdle(); | 200 loop_.RunUntilIdle(); |
202 | 201 |
203 const PolicyBundle kEmptyBundle; | 202 const PolicyBundle kEmptyBundle; |
204 EXPECT_TRUE(provider_->policies().Equals(kEmptyBundle)); | 203 EXPECT_TRUE(provider_->policies().Equals(kEmptyBundle)); |
205 } | 204 } |
206 | 205 |
207 void ConfigurationPolicyProviderTest::TearDown() { | 206 void ConfigurationPolicyProviderTest::TearDown() { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, | 404 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, |
406 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) | 405 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) |
407 .CopyFrom(expected_policy); | 406 .CopyFrom(expected_policy); |
408 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, | 407 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, |
409 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) | 408 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")) |
410 .CopyFrom(expected_policy); | 409 .CopyFrom(expected_policy); |
411 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); | 410 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); |
412 } | 411 } |
413 | 412 |
414 } // namespace policy | 413 } // namespace policy |
OLD | NEW |