OLD | NEW |
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 "components/policy/core/common/policy_loader_win.h" | 5 #include "components/policy/core/common/policy_loader_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <userenv.h> | 10 #include <userenv.h> |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 PRegTestHarness::PRegTestHarness() | 466 PRegTestHarness::PRegTestHarness() |
467 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 467 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
468 POLICY_SOURCE_PLATFORM) { | 468 POLICY_SOURCE_PLATFORM) { |
469 } | 469 } |
470 | 470 |
471 PRegTestHarness::~PRegTestHarness() {} | 471 PRegTestHarness::~PRegTestHarness() {} |
472 | 472 |
473 void PRegTestHarness::SetUp() { | 473 void PRegTestHarness::SetUp() { |
474 base::win::SetDomainStateForTesting(false); | 474 base::win::SetDomainStateForTesting(false); |
475 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 475 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
476 preg_file_path_ = temp_dir_.path().Append(PolicyLoaderWin::kPRegFileName); | 476 preg_file_path_ = temp_dir_.GetPath().Append(PolicyLoaderWin::kPRegFileName); |
477 ASSERT_TRUE(base::WriteFile(preg_file_path_, | 477 ASSERT_TRUE(base::WriteFile(preg_file_path_, |
478 preg_parser::kPRegFileHeader, | 478 preg_parser::kPRegFileHeader, |
479 arraysize(preg_parser::kPRegFileHeader))); | 479 arraysize(preg_parser::kPRegFileHeader))); |
480 | 480 |
481 memset(&gpo_, 0, sizeof(GROUP_POLICY_OBJECT)); | 481 memset(&gpo_, 0, sizeof(GROUP_POLICY_OBJECT)); |
482 gpo_.lpFileSysPath = const_cast<wchar_t*>(temp_dir_.path().value().c_str()); | 482 gpo_.lpFileSysPath = |
| 483 const_cast<wchar_t*>(temp_dir_.GetPath().value().c_str()); |
483 } | 484 } |
484 | 485 |
485 ConfigurationPolicyProvider* PRegTestHarness::CreateProvider( | 486 ConfigurationPolicyProvider* PRegTestHarness::CreateProvider( |
486 SchemaRegistry* registry, | 487 SchemaRegistry* registry, |
487 scoped_refptr<base::SequencedTaskRunner> task_runner) { | 488 scoped_refptr<base::SequencedTaskRunner> task_runner) { |
488 std::unique_ptr<AsyncPolicyLoader> loader( | 489 std::unique_ptr<AsyncPolicyLoader> loader( |
489 new PolicyLoaderWin(task_runner, kTestPolicyKey, this)); | 490 new PolicyLoaderWin(task_runner, kTestPolicyKey, this)); |
490 return new AsyncPolicyProvider(registry, std::move(loader)); | 491 return new AsyncPolicyProvider(registry, std::move(loader)); |
491 } | 492 } |
492 | 493 |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 expected.Get(ns_a).LoadFrom(&expected_a, POLICY_LEVEL_MANDATORY, | 1191 expected.Get(ns_a).LoadFrom(&expected_a, POLICY_LEVEL_MANDATORY, |
1191 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM); | 1192 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM); |
1192 base::DictionaryValue expected_b; | 1193 base::DictionaryValue expected_b; |
1193 expected_b.SetInteger("policy 1", 2); | 1194 expected_b.SetInteger("policy 1", 2); |
1194 expected.Get(ns_b).LoadFrom(&expected_b, POLICY_LEVEL_MANDATORY, | 1195 expected.Get(ns_b).LoadFrom(&expected_b, POLICY_LEVEL_MANDATORY, |
1195 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM); | 1196 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PLATFORM); |
1196 EXPECT_TRUE(Matches(expected)); | 1197 EXPECT_TRUE(Matches(expected)); |
1197 } | 1198 } |
1198 | 1199 |
1199 } // namespace policy | 1200 } // namespace policy |
OLD | NEW |