OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/win/registry.h" | 5 #include "base/win/registry.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 protected: | 21 protected: |
22 #if defined(_WIN64) | 22 #if defined(_WIN64) |
23 static const REGSAM kNativeViewMask = KEY_WOW64_64KEY; | 23 static const REGSAM kNativeViewMask = KEY_WOW64_64KEY; |
24 static const REGSAM kRedirectedViewMask = KEY_WOW64_32KEY; | 24 static const REGSAM kRedirectedViewMask = KEY_WOW64_32KEY; |
25 #else | 25 #else |
26 static const REGSAM kNativeViewMask = KEY_WOW64_32KEY; | 26 static const REGSAM kNativeViewMask = KEY_WOW64_32KEY; |
27 static const REGSAM kRedirectedViewMask = KEY_WOW64_64KEY; | 27 static const REGSAM kRedirectedViewMask = KEY_WOW64_64KEY; |
28 #endif // _WIN64 | 28 #endif // _WIN64 |
29 | 29 |
30 RegistryTest() {} | 30 RegistryTest() {} |
31 virtual void SetUp() OVERRIDE { | 31 void SetUp() override { |
32 // Create a temporary key. | 32 // Create a temporary key. |
33 RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); | 33 RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); |
34 key.DeleteKey(kRootKey); | 34 key.DeleteKey(kRootKey); |
35 ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, kRootKey, KEY_READ)); | 35 ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, kRootKey, KEY_READ)); |
36 ASSERT_EQ(ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, kRootKey, KEY_READ)); | 36 ASSERT_EQ(ERROR_SUCCESS, key.Create(HKEY_CURRENT_USER, kRootKey, KEY_READ)); |
37 foo_software_key_ = L"Software\\"; | 37 foo_software_key_ = L"Software\\"; |
38 foo_software_key_ += kRootKey; | 38 foo_software_key_ += kRootKey; |
39 foo_software_key_ += L"\\Foo"; | 39 foo_software_key_ += L"\\Foo"; |
40 } | 40 } |
41 | 41 |
42 virtual void TearDown() OVERRIDE { | 42 void TearDown() override { |
43 // Clean up the temporary key. | 43 // Clean up the temporary key. |
44 RegKey key(HKEY_CURRENT_USER, L"", KEY_SET_VALUE); | 44 RegKey key(HKEY_CURRENT_USER, L"", KEY_SET_VALUE); |
45 ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(kRootKey)); | 45 ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(kRootKey)); |
46 ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, kRootKey, KEY_READ)); | 46 ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, kRootKey, KEY_READ)); |
47 } | 47 } |
48 | 48 |
49 static bool IsRedirectorPresent() { | 49 static bool IsRedirectorPresent() { |
50 #if defined(_WIN64) | 50 #if defined(_WIN64) |
51 return true; | 51 return true; |
52 #else | 52 #else |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 key.Open(HKEY_CURRENT_USER, foo_key.c_str(), KEY_READ)); | 346 key.Open(HKEY_CURRENT_USER, foo_key.c_str(), KEY_READ)); |
347 | 347 |
348 ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, kRootKey, KEY_WRITE)); | 348 ASSERT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, kRootKey, KEY_WRITE)); |
349 ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(L"foo")); | 349 ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(L"foo")); |
350 } | 350 } |
351 | 351 |
352 } // namespace | 352 } // namespace |
353 | 353 |
354 } // namespace win | 354 } // namespace win |
355 } // namespace base | 355 } // namespace base |
OLD | NEW |