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

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

Issue 10491013: Implement the windows policy provider based on the AsyncPolicyLoader. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed comment Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/policy/policy_loader_win.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_loader_win_unittest.cc
diff --git a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc b/chrome/browser/policy/policy_loader_win_unittest.cc
similarity index 91%
rename from chrome/browser/policy/configuration_policy_provider_win_unittest.cc
rename to chrome/browser/policy/policy_loader_win_unittest.cc
index d8d9142353c6210eba7169326691a3bf1f41eec0..949392eb2ebe27911bac0e852b131fb256bf5a6e 100644
--- a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc
+++ b/chrome/browser/policy/policy_loader_win_unittest.cc
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <gtest/gtest.h>
+#include "chrome/browser/policy/policy_loader_win.h"
+
#include <windows.h>
#include "base/json/json_writer.h"
@@ -10,9 +11,8 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
-#include "chrome/browser/policy/asynchronous_policy_test_base.h"
+#include "chrome/browser/policy/async_policy_provider.h"
#include "chrome/browser/policy/configuration_policy_provider_test.h"
-#include "chrome/browser/policy/configuration_policy_provider_win.h"
#include "chrome/browser/policy/policy_bundle.h"
#include "chrome/browser/policy/policy_map.h"
#include "policy/policy_constants.h"
@@ -140,8 +140,9 @@ TestHarness::~TestHarness() {}
void TestHarness::SetUp() {}
ConfigurationPolicyProvider* TestHarness::CreateProvider(
- const PolicyDefinitionList* policy_definition_list) {
- return new ConfigurationPolicyProviderWin(policy_definition_list);
+ const PolicyDefinitionList* policy_list) {
+ scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderWin(policy_list));
+ return new AsyncPolicyProvider(policy_list, loader.Pass());
}
void TestHarness::InstallEmptyPolicy() {}
@@ -210,22 +211,20 @@ PolicyProviderTestHarness* TestHarness::CreateHKLM() {
// Instantiate abstract test case for basic policy reading tests.
INSTANTIATE_TEST_CASE_P(
- ConfigurationPolicyProviderWinTest,
+ PolicyProviderWinTest,
ConfigurationPolicyProviderTest,
testing::Values(TestHarness::CreateHKCU, TestHarness::CreateHKLM));
// Test cases for windows policy provider specific functionality.
-class ConfigurationPolicyProviderWinTest : public AsynchronousPolicyTestBase {
+class PolicyLoaderWinTest : public PolicyTestBase {
protected:
- ConfigurationPolicyProviderWinTest()
- : provider_(&test_policy_definitions::kList) {}
- virtual ~ConfigurationPolicyProviderWinTest() {}
+ PolicyLoaderWinTest() {}
+ virtual ~PolicyLoaderWinTest() {}
ScopedGroupPolicyRegistrySandbox registry_sandbox_;
- ConfigurationPolicyProviderWin provider_;
};
-TEST_F(ConfigurationPolicyProviderWinTest, HKLMOverHKCU) {
+TEST_F(PolicyLoaderWinTest, HKLMOverHKCU) {
RegKey hklm_key(HKEY_LOCAL_MACHINE,
policy::kRegistryMandatorySubKey,
KEY_ALL_ACCESS);
@@ -237,8 +236,8 @@ TEST_F(ConfigurationPolicyProviderWinTest, HKLMOverHKCU) {
hkcu_key.WriteValue(UTF8ToUTF16(test_policy_definitions::kKeyString).c_str(),
UTF8ToUTF16("hkcu").c_str());
- provider_.RefreshPolicies();
- loop_.RunAllPending();
+ PolicyLoaderWin loader(&test_policy_definitions::kList);
+ scoped_ptr<PolicyBundle> bundle(loader.Load());
PolicyBundle expected_bundle;
expected_bundle.Get(POLICY_DOMAIN_CHROME, "")
@@ -246,7 +245,7 @@ TEST_F(ConfigurationPolicyProviderWinTest, HKLMOverHKCU) {
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
base::Value::CreateStringValue("hklm"));
- EXPECT_TRUE(provider_.policies().Equals(expected_bundle));
+ EXPECT_TRUE(bundle->Equals(expected_bundle));
}
} // namespace policy
« no previous file with comments | « chrome/browser/policy/policy_loader_win.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698