Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: chrome/browser/policy/policy_service_impl_unittest.cc

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/policy/policy_service_impl.cc ('k') | chrome/browser/policy/policy_service_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_service_impl_unittest.cc
diff --git a/chrome/browser/policy/policy_service_impl_unittest.cc b/chrome/browser/policy/policy_service_impl_unittest.cc
index a02f38f30d6d5f0d1cb0e910acee817991d35c5c..365e5ffec50705a060a1fbfa68cbc6ee326c0311 100644
--- a/chrome/browser/policy/policy_service_impl_unittest.cc
+++ b/chrome/browser/policy/policy_service_impl_unittest.cc
@@ -7,15 +7,12 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
-#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/values.h"
#include "chrome/browser/policy/external_data_fetcher.h"
#include "chrome/browser/policy/mock_configuration_policy_provider.h"
#include "chrome/browser/policy/mock_policy_service.h"
-#include "chrome/browser/policy/policy_domain_descriptor.h"
-#include "components/policy/core/common/schema.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -605,62 +602,4 @@ TEST_F(PolicyServiceTest, IsInitializationComplete) {
policy_service_->RemoveObserver(POLICY_DOMAIN_EXTENSIONS, &observer);
}
-TEST_F(PolicyServiceTest, RegisterPolicyDomain) {
- EXPECT_FALSE(policy_service_->GetPolicyDomainDescriptor(POLICY_DOMAIN_CHROME)
- .get());
- EXPECT_FALSE(policy_service_->GetPolicyDomainDescriptor(
- POLICY_DOMAIN_EXTENSIONS).get());
-
- EXPECT_CALL(provider1_, RegisterPolicyDomain(_)).Times(AnyNumber());
- EXPECT_CALL(provider2_, RegisterPolicyDomain(_)).Times(AnyNumber());
-
- scoped_refptr<const PolicyDomainDescriptor> chrome_descriptor =
- new PolicyDomainDescriptor(POLICY_DOMAIN_CHROME);
- EXPECT_CALL(provider0_, RegisterPolicyDomain(chrome_descriptor));
- policy_service_->RegisterPolicyDomain(chrome_descriptor);
- Mock::VerifyAndClearExpectations(&provider0_);
-
- EXPECT_TRUE(policy_service_->GetPolicyDomainDescriptor(POLICY_DOMAIN_CHROME)
- .get());
- EXPECT_FALSE(policy_service_->GetPolicyDomainDescriptor(
- POLICY_DOMAIN_EXTENSIONS).get());
-
- // Register another namespace.
- std::string error;
- Schema schema = Schema::Parse(
- "{"
- " \"type\":\"object\","
- " \"properties\": {"
- " \"Boolean\": { \"type\": \"boolean\" },"
- " \"Integer\": { \"type\": \"integer\" },"
- " \"Null\": { \"type\": \"null\" },"
- " \"Number\": { \"type\": \"number\" },"
- " \"Object\": { \"type\": \"object\" },"
- " \"String\": { \"type\": \"string\" }"
- " }"
- "}", &error);
- ASSERT_TRUE(schema.valid()) << error;
- scoped_refptr<PolicyDomainDescriptor> extensions_descriptor =
- new PolicyDomainDescriptor(POLICY_DOMAIN_EXTENSIONS);
- extensions_descriptor->RegisterComponent(kExtension, schema);
- EXPECT_CALL(provider0_, RegisterPolicyDomain(
- scoped_refptr<const PolicyDomainDescriptor>(extensions_descriptor)));
- policy_service_->RegisterPolicyDomain(extensions_descriptor);
- Mock::VerifyAndClearExpectations(&provider0_);
-
- EXPECT_TRUE(policy_service_->GetPolicyDomainDescriptor(POLICY_DOMAIN_CHROME)
- .get());
- EXPECT_TRUE(policy_service_->GetPolicyDomainDescriptor(
- POLICY_DOMAIN_EXTENSIONS).get());
-
- // Remove those components.
- scoped_refptr<PolicyDomainDescriptor> empty_extensions_descriptor =
- new PolicyDomainDescriptor(POLICY_DOMAIN_EXTENSIONS);
- EXPECT_CALL(provider0_, RegisterPolicyDomain(
- scoped_refptr<const PolicyDomainDescriptor>(
- empty_extensions_descriptor)));
- policy_service_->RegisterPolicyDomain(empty_extensions_descriptor);
- Mock::VerifyAndClearExpectations(&provider0_);
-}
-
} // namespace policy
« no previous file with comments | « chrome/browser/policy/policy_service_impl.cc ('k') | chrome/browser/policy/policy_service_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698