| 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 <userenv.h> | 8 #include <userenv.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 buffer.insert(buffer.end(), type_data, type_data + sizeof(DWORD)); | 582 buffer.insert(buffer.end(), type_data, type_data + sizeof(DWORD)); |
| 583 AppendChars(&buffer, L";"); | 583 AppendChars(&buffer, L";"); |
| 584 size = base::ByteSwapToLE32(size); | 584 size = base::ByteSwapToLE32(size); |
| 585 uint8* size_data = reinterpret_cast<uint8*>(&size); | 585 uint8* size_data = reinterpret_cast<uint8*>(&size); |
| 586 buffer.insert(buffer.end(), size_data, size_data + sizeof(DWORD)); | 586 buffer.insert(buffer.end(), size_data, size_data + sizeof(DWORD)); |
| 587 AppendChars(&buffer, L";"); | 587 AppendChars(&buffer, L";"); |
| 588 buffer.insert(buffer.end(), data, data + size); | 588 buffer.insert(buffer.end(), data, data + size); |
| 589 AppendChars(&buffer, L"]"); | 589 AppendChars(&buffer, L"]"); |
| 590 | 590 |
| 591 ASSERT_EQ(buffer.size(), | 591 ASSERT_EQ(buffer.size(), |
| 592 file_util::AppendToFile( | 592 base::AppendToFile( |
| 593 preg_file_path_, | 593 preg_file_path_, |
| 594 reinterpret_cast<const char*>(vector_as_array(&buffer)), | 594 reinterpret_cast<const char*>(vector_as_array(&buffer)), |
| 595 buffer.size())); | 595 buffer.size())); |
| 596 } | 596 } |
| 597 | 597 |
| 598 void PRegTestHarness::AppendDWORDToPRegFile(const base::string16& path, | 598 void PRegTestHarness::AppendDWORDToPRegFile(const base::string16& path, |
| 599 const std::string& key, | 599 const std::string& key, |
| 600 DWORD value) { | 600 DWORD value) { |
| 601 value = base::ByteSwapToLE32(value); | 601 value = base::ByteSwapToLE32(value); |
| 602 AppendRecordToPRegFile(path, key, REG_DWORD, sizeof(DWORD), | 602 AppendRecordToPRegFile(path, key, REG_DWORD, sizeof(DWORD), |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 PolicyMap& expected_policy = expected.Get(ns); | 1197 PolicyMap& expected_policy = expected.Get(ns); |
| 1198 expected_policy.Set("alternative_browser_path", | 1198 expected_policy.Set("alternative_browser_path", |
| 1199 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 1199 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
| 1200 new base::StringValue("c:\\legacy\\browser.exe"), NULL); | 1200 new base::StringValue("c:\\legacy\\browser.exe"), NULL); |
| 1201 expected_policy.Set("url_list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 1201 expected_policy.Set("url_list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
| 1202 list.DeepCopy(), NULL); | 1202 list.DeepCopy(), NULL); |
| 1203 EXPECT_TRUE(Matches(expected)); | 1203 EXPECT_TRUE(Matches(expected)); |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 } // namespace policy | 1206 } // namespace policy |
| OLD | NEW |