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

Side by Side Diff: chrome/browser/extensions/api/storage/settings_apitest.cc

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months 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 unified diff | Download patch
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/json/json_writer.h" 6 #include "base/json/json_writer.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" 10 #include "chrome/browser/extensions/api/storage/settings_sync_util.h"
(...skipping 17 matching lines...) Expand all
28 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
29 29
30 #if defined(ENABLE_CONFIGURATION_POLICY) 30 #if defined(ENABLE_CONFIGURATION_POLICY)
31 #include "chrome/browser/policy/schema_registry_service.h" 31 #include "chrome/browser/policy/schema_registry_service.h"
32 #include "chrome/browser/policy/schema_registry_service_factory.h" 32 #include "chrome/browser/policy/schema_registry_service_factory.h"
33 #include "components/policy/core/browser/browser_policy_connector.h" 33 #include "components/policy/core/browser/browser_policy_connector.h"
34 #include "components/policy/core/common/mock_configuration_policy_provider.h" 34 #include "components/policy/core/common/mock_configuration_policy_provider.h"
35 #include "components/policy/core/common/policy_bundle.h" 35 #include "components/policy/core/common/policy_bundle.h"
36 #include "components/policy/core/common/policy_map.h" 36 #include "components/policy/core/common/policy_map.h"
37 #include "components/policy/core/common/policy_namespace.h" 37 #include "components/policy/core/common/policy_namespace.h"
38 #include "components/policy/core/common/policy_types.h"
39 #include "components/policy/core/common/schema.h" 38 #include "components/policy/core/common/schema.h"
40 #include "components/policy/core/common/schema_map.h" 39 #include "components/policy/core/common/schema_map.h"
41 #include "components/policy/core/common/schema_registry.h" 40 #include "components/policy/core/common/schema_registry.h"
42 #endif 41 #endif
43 42
44 namespace extensions { 43 namespace extensions {
45 44
46 using settings_namespace::LOCAL; 45 using settings_namespace::LOCAL;
47 using settings_namespace::MANAGED; 46 using settings_namespace::MANAGED;
48 using settings_namespace::Namespace; 47 using settings_namespace::Namespace;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void SendChanges(const syncer::SyncChangeList& change_list) { 127 void SendChanges(const syncer::SyncChangeList& change_list) {
129 base::MessageLoop::current()->RunUntilIdle(); 128 base::MessageLoop::current()->RunUntilIdle();
130 SendChangesToSyncableService(change_list, GetSyncableService()); 129 SendChangesToSyncableService(change_list, GetSyncableService());
131 } 130 }
132 131
133 #if defined(ENABLE_CONFIGURATION_POLICY) 132 #if defined(ENABLE_CONFIGURATION_POLICY)
134 void SetPolicies(const base::DictionaryValue& policies) { 133 void SetPolicies(const base::DictionaryValue& policies) {
135 scoped_ptr<policy::PolicyBundle> bundle(new policy::PolicyBundle()); 134 scoped_ptr<policy::PolicyBundle> bundle(new policy::PolicyBundle());
136 policy::PolicyMap& policy_map = bundle->Get(policy::PolicyNamespace( 135 policy::PolicyMap& policy_map = bundle->Get(policy::PolicyNamespace(
137 policy::POLICY_DOMAIN_EXTENSIONS, kManagedStorageExtensionId)); 136 policy::POLICY_DOMAIN_EXTENSIONS, kManagedStorageExtensionId));
138 policy_map.LoadFrom(&policies, policy::POLICY_LEVEL_MANDATORY, 137 policy_map.LoadFrom(
139 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD); 138 &policies, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER);
140 policy_provider_.UpdatePolicy(bundle.Pass()); 139 policy_provider_.UpdatePolicy(bundle.Pass());
141 } 140 }
142 #endif 141 #endif
143 142
144 private: 143 private:
145 const Extension* MaybeLoadAndReplyWhenSatisfied( 144 const Extension* MaybeLoadAndReplyWhenSatisfied(
146 Namespace settings_namespace, 145 Namespace settings_namespace,
147 const std::string& normal_action, 146 const std::string& normal_action,
148 const std::string& incognito_action, 147 const std::string& incognito_action,
149 // May be NULL to imply not loading the extension. 148 // May be NULL to imply not loading the extension.
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 // ENABLE_CONFIGURATION_POLICY is not defined. 572 // ENABLE_CONFIGURATION_POLICY is not defined.
574 StorageFrontend* frontend = StorageFrontend::Get(browser()->profile()); 573 StorageFrontend* frontend = StorageFrontend::Get(browser()->profile());
575 frontend->DisableStorageForTesting(MANAGED); 574 frontend->DisableStorageForTesting(MANAGED);
576 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); 575 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED));
577 // Now run the extension. 576 // Now run the extension.
578 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) 577 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled"))
579 << message_; 578 << message_;
580 } 579 }
581 580
582 } // namespace extensions 581 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698