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

Unified Diff: components/policy/core/common/policy_loader_win_unittest.cc

Issue 152633003: On enterprise machines read policy from the registry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed the tests and added a new one. Created 6 years, 10 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 | « components/policy/core/common/policy_loader_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/policy_loader_win_unittest.cc
diff --git a/components/policy/core/common/policy_loader_win_unittest.cc b/components/policy/core/common/policy_loader_win_unittest.cc
index 13a3ed0602ed773ea1739064b0aa214f79d2adf0..3383d04ece5e7758faf60acc58a7bfc28c6e6c40 100644
--- a/components/policy/core/common/policy_loader_win_unittest.cc
+++ b/components/policy/core/common/policy_loader_win_unittest.cc
@@ -28,6 +28,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/sys_byteorder.h"
#include "base/win/registry.h"
+#include "base/win/win_util.h"
#include "components/policy/core/common/async_policy_provider.h"
#include "components/policy/core/common/configuration_policy_provider_test.h"
#include "components/policy/core/common/external_data_fetcher.h"
@@ -346,6 +347,7 @@ void RegistryTestHarness::SetUp() {}
ConfigurationPolicyProvider* RegistryTestHarness::CreateProvider(
SchemaRegistry* registry,
scoped_refptr<base::SequencedTaskRunner> task_runner) {
+ base::win::SetDomainStateForTesting(true);
scoped_ptr<AsyncPolicyLoader> loader(
new PolicyLoaderWin(task_runner, kTestPolicyKey, this));
return new AsyncPolicyProvider(registry, loader.Pass());
@@ -463,6 +465,7 @@ PRegTestHarness::PRegTestHarness()
PRegTestHarness::~PRegTestHarness() {}
void PRegTestHarness::SetUp() {
+ base::win::SetDomainStateForTesting(false);
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
preg_file_path_ = temp_dir_.path().Append(PolicyLoaderWin::kPRegFileName);
ASSERT_TRUE(file_util::WriteFile(preg_file_path_,
@@ -702,6 +705,7 @@ class PolicyLoaderWinTest : public PolicyTestBase,
virtual ~PolicyLoaderWinTest() {}
virtual void SetUp() OVERRIDE {
+ base::win::SetDomainStateForTesting(false);
PolicyTestBase::SetUp();
ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir_));
@@ -1024,6 +1028,19 @@ TEST_F(PolicyLoaderWinTest, AppliedPolicyEmpty) {
EXPECT_TRUE(Matches(empty));
}
+TEST_F(PolicyLoaderWinTest, AppliedPolicyInDomain) {
+ base::win::SetDomainStateForTesting(true);
+ InstallRegistrySentinel();
+ base::FilePath gpo_dir(test_data_dir_.AppendASCII("empty"));
+ GROUP_POLICY_OBJECT gpo;
+ InitGPO(&gpo, 0, gpo_dir, NULL, NULL);
+ gpo_list_ = &gpo;
+ gpo_list_status_ = ERROR_SUCCESS;
+
+ PolicyBundle empty;
+ EXPECT_TRUE(MatchesRegistrySentinel());
+}
+
TEST_F(PolicyLoaderWinTest, AppliedPolicyNonExistingFile) {
InstallRegistrySentinel();
GROUP_POLICY_OBJECT gpo;
« no previous file with comments | « components/policy/core/common/policy_loader_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698