Cleanups to the policy code.

This is a follow-up to https://codereview.chromium.org/337053005.

BUG=224596

Review URL: https://codereview.chromium.org/392233003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283549 0039d316-1c4b-4281-b951-d872f2087c98
parent e81aba4d
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "components/policy/core/common/cloud/device_management_service.h" #include "components/policy/core/common/cloud/device_management_service.h"
#include "components/policy/core/common/cloud/resource_cache.h" #include "components/policy/core/common/cloud/resource_cache.h"
#include "components/policy/core/common/cloud/system_policy_request_context.h" #include "components/policy/core/common/cloud/system_policy_request_context.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_switches.h" #include "components/policy/core/common/policy_switches.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_context_getter.h"
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
#include <algorithm>
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/callback.h" #include "base/callback.h"
...@@ -41,6 +43,7 @@ ...@@ -41,6 +43,7 @@
#include "net/url_request/url_request_test_util.h" #include "net/url_request/url_request_test_util.h"
#include "policy/policy_constants.h" #include "policy/policy_constants.h"
#include "policy/proto/cloud_policy.pb.h" #include "policy/proto/cloud_policy.pb.h"
#include "policy/proto/device_management_backend.pb.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using testing::AnyNumber; using testing::AnyNumber;
...@@ -422,9 +425,7 @@ TEST_F(DeviceLocalAccountPolicyServiceTest, FetchPolicy) { ...@@ -422,9 +425,7 @@ TEST_F(DeviceLocalAccountPolicyServiceTest, FetchPolicy) {
// The order is not guarateed. // The order is not guarateed.
if (extensions->policy_type() == if (extensions->policy_type() ==
dm_protocol::kChromePublicAccountPolicyType) { dm_protocol::kChromePublicAccountPolicyType) {
const em::PolicyFetchRequest* tmp = public_account; std::swap(public_account, extensions);
public_account = extensions;
extensions = tmp;
} }
EXPECT_EQ(dm_protocol::kChromePublicAccountPolicyType, EXPECT_EQ(dm_protocol::kChromePublicAccountPolicyType,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "components/policy/core/common/forwarding_policy_provider.h" #include "components/policy/core/common/forwarding_policy_provider.h"
#include <string>
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/values.h" #include "base/values.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h" #include "components/policy/core/common/mock_configuration_policy_provider.h"
......
...@@ -205,9 +205,9 @@ ForwardingSchemaRegistry::~ForwardingSchemaRegistry() { ...@@ -205,9 +205,9 @@ ForwardingSchemaRegistry::~ForwardingSchemaRegistry() {
void ForwardingSchemaRegistry::RegisterComponents( void ForwardingSchemaRegistry::RegisterComponents(
PolicyDomain domain, PolicyDomain domain,
const ComponentMap& components) { const ComponentMap& components) {
// POLICY_DOMAIN_CHROME is skipped to avoid spurious updated when a new // POLICY_DOMAIN_CHROME is skipped to avoid spurious updates when a new
// Profile is created. If the ForwardingSchemaRegistry is meant to be used // Profile is created. If the ForwardingSchemaRegistry is used outside
// outside device-level accounts then this should become configurable. // device-level accounts then this should become configurable.
if (wrapped_ && domain != POLICY_DOMAIN_CHROME) if (wrapped_ && domain != POLICY_DOMAIN_CHROME)
wrapped_->RegisterComponents(domain, components); wrapped_->RegisterComponents(domain, components);
// Ignore otherwise. // Ignore otherwise.
......
...@@ -272,11 +272,9 @@ TEST(SchemaRegistryTest, ForwardingSchemaRegistry) { ...@@ -272,11 +272,9 @@ TEST(SchemaRegistryTest, ForwardingSchemaRegistry) {
EXPECT_FALSE(registry->IsReady()); EXPECT_FALSE(registry->IsReady());
EXPECT_FALSE(forwarding.IsReady()); EXPECT_FALSE(forwarding.IsReady());
#if defined(ENABLE_EXTENSIONS)
registry->SetReady(POLICY_DOMAIN_EXTENSIONS); registry->SetReady(POLICY_DOMAIN_EXTENSIONS);
EXPECT_FALSE(registry->IsReady()); EXPECT_FALSE(registry->IsReady());
EXPECT_FALSE(forwarding.IsReady()); EXPECT_FALSE(forwarding.IsReady());
#endif
registry->SetReady(POLICY_DOMAIN_CHROME); registry->SetReady(POLICY_DOMAIN_CHROME);
EXPECT_TRUE(registry->IsReady()); EXPECT_TRUE(registry->IsReady());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment