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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 uint8* type_data = reinterpret_cast<uint8*>(&type); | 581 uint8* type_data = reinterpret_cast<uint8*>(&type); |
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_TRUE(base::AppendToFile( |
592 base::AppendToFile( | 592 preg_file_path_, |
593 preg_file_path_, | 593 reinterpret_cast<const char*>(vector_as_array(&buffer)), |
594 reinterpret_cast<const char*>(vector_as_array(&buffer)), | 594 buffer.size())); |
595 buffer.size())); | |
596 } | 595 } |
597 | 596 |
598 void PRegTestHarness::AppendDWORDToPRegFile(const base::string16& path, | 597 void PRegTestHarness::AppendDWORDToPRegFile(const base::string16& path, |
599 const std::string& key, | 598 const std::string& key, |
600 DWORD value) { | 599 DWORD value) { |
601 value = base::ByteSwapToLE32(value); | 600 value = base::ByteSwapToLE32(value); |
602 AppendRecordToPRegFile(path, key, REG_DWORD, sizeof(DWORD), | 601 AppendRecordToPRegFile(path, key, REG_DWORD, sizeof(DWORD), |
603 reinterpret_cast<uint8*>(&value)); | 602 reinterpret_cast<uint8*>(&value)); |
604 } | 603 } |
605 | 604 |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 PolicyMap& expected_policy = expected.Get(ns); | 1208 PolicyMap& expected_policy = expected.Get(ns); |
1210 expected_policy.Set("alternative_browser_path", | 1209 expected_policy.Set("alternative_browser_path", |
1211 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 1210 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
1212 new base::StringValue("c:\\legacy\\browser.exe"), NULL); | 1211 new base::StringValue("c:\\legacy\\browser.exe"), NULL); |
1213 expected_policy.Set("url_list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 1212 expected_policy.Set("url_list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
1214 list.DeepCopy(), NULL); | 1213 list.DeepCopy(), NULL); |
1215 EXPECT_TRUE(Matches(expected)); | 1214 EXPECT_TRUE(Matches(expected)); |
1216 } | 1215 } |
1217 | 1216 |
1218 } // namespace policy | 1217 } // namespace policy |
OLD | NEW |