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 "chrome/browser/policy/policy_service_impl.h" | 5 #include "chrome/browser/policy/policy_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/policy/external_data_fetcher.h" | 14 #include "chrome/browser/policy/external_data_fetcher.h" |
15 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 15 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
16 #include "chrome/browser/policy/mock_policy_service.h" | 16 #include "chrome/browser/policy/mock_policy_service.h" |
17 #include "chrome/browser/policy/policy_domain_descriptor.h" | 17 #include "chrome/browser/policy/policy_domain_descriptor.h" |
18 #include "components/policy/core/common/policy_schema.h" | 18 #include "components/policy/core/common/schema.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 using ::testing::AnyNumber; | 22 using ::testing::AnyNumber; |
23 using ::testing::Mock; | 23 using ::testing::Mock; |
24 using ::testing::Return; | 24 using ::testing::Return; |
25 using ::testing::_; | 25 using ::testing::_; |
26 | 26 |
27 namespace policy { | 27 namespace policy { |
28 | 28 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 policy_service_->RegisterPolicyDomain(chrome_descriptor); | 620 policy_service_->RegisterPolicyDomain(chrome_descriptor); |
621 Mock::VerifyAndClearExpectations(&provider0_); | 621 Mock::VerifyAndClearExpectations(&provider0_); |
622 | 622 |
623 EXPECT_TRUE(policy_service_->GetPolicyDomainDescriptor(POLICY_DOMAIN_CHROME) | 623 EXPECT_TRUE(policy_service_->GetPolicyDomainDescriptor(POLICY_DOMAIN_CHROME) |
624 .get()); | 624 .get()); |
625 EXPECT_FALSE(policy_service_->GetPolicyDomainDescriptor( | 625 EXPECT_FALSE(policy_service_->GetPolicyDomainDescriptor( |
626 POLICY_DOMAIN_EXTENSIONS).get()); | 626 POLICY_DOMAIN_EXTENSIONS).get()); |
627 | 627 |
628 // Register another namespace. | 628 // Register another namespace. |
629 std::string error; | 629 std::string error; |
630 scoped_ptr<PolicySchema> schema = PolicySchema::Parse( | 630 scoped_ptr<SchemaOwner> schema = SchemaOwner::Parse( |
631 "{" | 631 "{" |
632 " \"$schema\":\"http://json-schema.org/draft-03/schema#\"," | |
633 " \"type\":\"object\"," | 632 " \"type\":\"object\"," |
634 " \"properties\": {" | 633 " \"properties\": {" |
635 " \"Boolean\": { \"type\": \"boolean\" }," | 634 " \"Boolean\": { \"type\": \"boolean\" }," |
636 " \"Integer\": { \"type\": \"integer\" }," | 635 " \"Integer\": { \"type\": \"integer\" }," |
637 " \"Null\": { \"type\": \"null\" }," | 636 " \"Null\": { \"type\": \"null\" }," |
638 " \"Number\": { \"type\": \"number\" }," | 637 " \"Number\": { \"type\": \"number\" }," |
639 " \"Object\": { \"type\": \"object\" }," | 638 " \"Object\": { \"type\": \"object\" }," |
640 " \"String\": { \"type\": \"string\" }" | 639 " \"String\": { \"type\": \"string\" }" |
641 " }" | 640 " }" |
642 "}", &error); | 641 "}", &error); |
(...skipping 15 matching lines...) Expand all Loading... |
658 scoped_refptr<PolicyDomainDescriptor> empty_extensions_descriptor = | 657 scoped_refptr<PolicyDomainDescriptor> empty_extensions_descriptor = |
659 new PolicyDomainDescriptor(POLICY_DOMAIN_EXTENSIONS); | 658 new PolicyDomainDescriptor(POLICY_DOMAIN_EXTENSIONS); |
660 EXPECT_CALL(provider0_, RegisterPolicyDomain( | 659 EXPECT_CALL(provider0_, RegisterPolicyDomain( |
661 scoped_refptr<const PolicyDomainDescriptor>( | 660 scoped_refptr<const PolicyDomainDescriptor>( |
662 empty_extensions_descriptor))); | 661 empty_extensions_descriptor))); |
663 policy_service_->RegisterPolicyDomain(empty_extensions_descriptor); | 662 policy_service_->RegisterPolicyDomain(empty_extensions_descriptor); |
664 Mock::VerifyAndClearExpectations(&provider0_); | 663 Mock::VerifyAndClearExpectations(&provider0_); |
665 } | 664 } |
666 | 665 |
667 } // namespace policy | 666 } // namespace policy |
OLD | NEW |