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

Side by Side Diff: rlz/test/rlz_test_helpers.cc

Issue 616173003: Allow Registry Iterator functions to use a specified WOW64 mode when iterating. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
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 // Main entry point for all unit tests. 5 // Main entry point for all unit tests.
6 6
7 #include "rlz_test_helpers.h" 7 #include "rlz_test_helpers.h"
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 }; 39 };
40 40
41 struct RegistryKeyData { 41 struct RegistryKeyData {
42 std::vector<RegistryValue> values; 42 std::vector<RegistryValue> values;
43 std::map<base::string16, RegistryKeyData> keys; 43 std::map<base::string16, RegistryKeyData> keys;
44 }; 44 };
45 45
46 void ReadRegistryTree(const base::win::RegKey& src, RegistryKeyData* data) { 46 void ReadRegistryTree(const base::win::RegKey& src, RegistryKeyData* data) {
47 // First read values. 47 // First read values.
48 { 48 {
49 base::win::RegistryValueIterator i(src.Handle(), L""); 49 base::win::RegistryValueIterator i(src.Handle(), L"", 0);
50 data->values.clear(); 50 data->values.clear();
51 data->values.reserve(i.ValueCount()); 51 data->values.reserve(i.ValueCount());
52 for (; i.Valid(); ++i) { 52 for (; i.Valid(); ++i) {
53 RegistryValue& value = *data->values.insert(data->values.end(), 53 RegistryValue& value = *data->values.insert(data->values.end(),
54 RegistryValue()); 54 RegistryValue());
55 const uint8* data = reinterpret_cast<const uint8*>(i.Value()); 55 const uint8* data = reinterpret_cast<const uint8*>(i.Value());
56 value.name.assign(i.Name()); 56 value.name.assign(i.Name());
57 value.type = i.Type(); 57 value.type = i.Type();
58 value.data.assign(data, data + i.ValueSize()); 58 value.data.assign(data, data + i.ValueSize());
59 } 59 }
60 } 60 }
61 61
62 // Next read subkeys recursively. 62 // Next read subkeys recursively.
63 for (base::win::RegistryKeyIterator i(src.Handle(), L""); 63 for (base::win::RegistryKeyIterator i(src.Handle(), L"", 0);
64 i.Valid(); ++i) { 64 i.Valid(); ++i) {
65 ReadRegistryTree(base::win::RegKey(src.Handle(), i.Name(), KEY_READ), 65 ReadRegistryTree(base::win::RegKey(src.Handle(), i.Name(), KEY_READ),
66 &data->keys[base::string16(i.Name())]); 66 &data->keys[base::string16(i.Name())]);
67 } 67 }
68 } 68 }
69 69
70 void WriteRegistryTree(const RegistryKeyData& data, base::win::RegKey* dest) { 70 void WriteRegistryTree(const RegistryKeyData& data, base::win::RegKey* dest) {
71 // First write values. 71 // First write values.
72 for (size_t i = 0; i < data.values.size(); ++i) { 72 for (size_t i = 0; i < data.values.size(); ++i) {
73 const RegistryValue& value = data.values[i]; 73 const RegistryValue& value = data.values[i];
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 rlz_lib::testing::SetRlzStoreDirectory(base::FilePath()); 142 rlz_lib::testing::SetRlzStoreDirectory(base::FilePath());
143 #endif // defined(OS_POSIX) 143 #endif // defined(OS_POSIX)
144 } 144 }
145 145
146 void RlzLibTestBase::SetUp() { 146 void RlzLibTestBase::SetUp() {
147 RlzLibTestNoMachineState::SetUp(); 147 RlzLibTestNoMachineState::SetUp();
148 #if defined(OS_WIN) 148 #if defined(OS_WIN)
149 rlz_lib::CreateMachineState(); 149 rlz_lib::CreateMachineState();
150 #endif // defined(OS_WIN) 150 #endif // defined(OS_WIN)
151 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698