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

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: Fixed mac tests 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
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..c6b76e1687bd261d5ce5f157a432d913eac52131 100644
--- a/chrome/browser/policy/policy_service_impl_unittest.cc
+++ b/chrome/browser/policy/policy_service_impl_unittest.cc
@@ -14,7 +14,6 @@
#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"
bartfab (slow) 2013/11/05 15:53:04 Nit: No longer used.
Joao da Silva 2013/11/07 13:15:00 Done.
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -605,62 +604,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

Powered by Google App Engine
This is Rietveld 408576698