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

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

Issue 109743002: Move policy code into components/policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar fixes Created 7 years 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/configuration_policy_pref_store_unittest.cc
diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
index 645514eda9f2a604816c3b4a823d39f8242fd33b..9a45c6fc9b43487e663a156434cd1a9a87db09b7 100644
--- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
@@ -2,74 +2,40 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/policy/configuration_policy_pref_store_unittest.h"
-
#include <string>
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/prefs/pref_store_observer_mock.h"
#include "base/run_loop.h"
-#include "chrome/browser/policy/configuration_policy_handler.h"
-#include "chrome/browser/policy/configuration_policy_pref_store.h"
-#include "chrome/browser/policy/policy_service_impl.h"
+#include "chrome/browser/policy/configuration_policy_pref_store_test.h"
+#include "components/policy/core/browser/configuration_policy_handler.h"
+#include "components/policy/core/browser/configuration_policy_pref_store.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_details.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_pref_names.h"
+#include "components/policy/core/common/policy_service_impl.h"
#include "testing/gmock/include/gmock/gmock.h"
+// Note: this file should move to components/policy/core/browser, but the
+// components_unittests runner does not load the ResourceBundle as
+// ChromeTestSuite::Initialize does, which leads to failures using
+// PolicyErrorMap.
+
using testing::Mock;
using testing::Return;
using testing::_;
namespace {
+
const char kTestPolicy[] = "test.policy";
const char kTestPref[] = "test.pref";
+
} // namespace
namespace policy {
-// Holds a set of test parameters, consisting of pref name and policy name.
-class PolicyAndPref {
- public:
- PolicyAndPref(const char* policy_name, const char* pref_name)
- : policy_name_(policy_name),
- pref_name_(pref_name) {}
-
- const char* policy_name() const { return policy_name_; }
- const char* pref_name() const { return pref_name_; }
-
- private:
- const char* policy_name_;
- const char* pref_name_;
-};
-
-ConfigurationPolicyPrefStoreTest::ConfigurationPolicyPrefStoreTest()
- : handler_list_(GetChromePolicyDetailsCallback()) {
- EXPECT_CALL(provider_, IsInitializationComplete(_))
- .WillRepeatedly(Return(false));
- provider_.Init();
- providers_.push_back(&provider_);
- policy_service_.reset(new PolicyServiceImpl(
- providers_, PolicyServiceImpl::PreprocessCallback()));
- store_ = new ConfigurationPolicyPrefStore(
- policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY);
-}
-
-ConfigurationPolicyPrefStoreTest::~ConfigurationPolicyPrefStoreTest() {}
-
-void ConfigurationPolicyPrefStoreTest::TearDown() {
- provider_.Shutdown();
-}
-
-void ConfigurationPolicyPrefStoreTest::UpdateProviderPolicy(
- const PolicyMap& policy) {
- provider_.UpdateChromePolicy(policy);
- base::RunLoop loop;
- loop.RunUntilIdle();
-}
-
// Test cases for list-valued policy settings.
class ConfigurationPolicyPrefStoreListTest
: public ConfigurationPolicyPrefStoreTest {

Powered by Google App Engine
This is Rietveld 408576698