| 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 // 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 <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // win32 APIs used by the tests continue to work: | 108 // win32 APIs used by the tests continue to work: |
| 109 // | 109 // |
| 110 // HKLM\System\CurrentControlSet\Control\Lsa\AccessProviders | 110 // HKLM\System\CurrentControlSet\Control\Lsa\AccessProviders |
| 111 // | 111 // |
| 112 // This seems to be required since Win7. | 112 // This seems to be required since Win7. |
| 113 ReadRegistryTree(base::win::RegKey(HKEY_LOCAL_MACHINE, | 113 ReadRegistryTree(base::win::RegKey(HKEY_LOCAL_MACHINE, |
| 114 kHKLMAccessProviders, | 114 kHKLMAccessProviders, |
| 115 KEY_READ), &data); | 115 KEY_READ), &data); |
| 116 } | 116 } |
| 117 | 117 |
| 118 override_manager->OverrideRegistry(HKEY_LOCAL_MACHINE); | 118 ASSERT_NO_FATAL_FAILURE( |
| 119 override_manager->OverrideRegistry(HKEY_CURRENT_USER); | 119 override_manager->OverrideRegistry(HKEY_LOCAL_MACHINE)); |
| 120 ASSERT_NO_FATAL_FAILURE( |
| 121 override_manager->OverrideRegistry(HKEY_CURRENT_USER)); |
| 120 | 122 |
| 121 if (do_copy) { | 123 if (do_copy) { |
| 122 base::win::RegKey key( | 124 base::win::RegKey key( |
| 123 HKEY_LOCAL_MACHINE, kHKLMAccessProviders, KEY_ALL_ACCESS); | 125 HKEY_LOCAL_MACHINE, kHKLMAccessProviders, KEY_ALL_ACCESS); |
| 124 WriteRegistryTree(data, &key); | 126 WriteRegistryTree(data, &key); |
| 125 } | 127 } |
| 126 } | 128 } |
| 127 | 129 |
| 128 } // namespace | 130 } // namespace |
| 129 | 131 |
| 130 #endif // defined(OS_WIN) | 132 #endif // defined(OS_WIN) |
| 131 | 133 |
| 132 void RlzLibTestNoMachineStateHelper::SetUp() { | 134 void RlzLibTestNoMachineStateHelper::SetUp() { |
| 133 #if defined(OS_WIN) | 135 #if defined(OS_WIN) |
| 134 InitializeRegistryOverridesForTesting(&override_manager_); | 136 ASSERT_NO_FATAL_FAILURE( |
| 137 InitializeRegistryOverridesForTesting(&override_manager_)); |
| 135 #elif defined(OS_MACOSX) | 138 #elif defined(OS_MACOSX) |
| 136 base::mac::ScopedNSAutoreleasePool pool; | 139 base::mac::ScopedNSAutoreleasePool pool; |
| 137 #endif // defined(OS_WIN) | 140 #endif // defined(OS_WIN) |
| 138 #if defined(OS_POSIX) | 141 #if defined(OS_POSIX) |
| 139 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 142 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 140 rlz_lib::testing::SetRlzStoreDirectory(temp_dir_.GetPath()); | 143 rlz_lib::testing::SetRlzStoreDirectory(temp_dir_.GetPath()); |
| 141 #endif // defined(OS_POSIX) | 144 #endif // defined(OS_POSIX) |
| 142 } | 145 } |
| 143 | 146 |
| 144 void RlzLibTestNoMachineStateHelper::TearDown() { | 147 void RlzLibTestNoMachineStateHelper::TearDown() { |
| 145 #if defined(OS_POSIX) | 148 #if defined(OS_POSIX) |
| 146 rlz_lib::testing::SetRlzStoreDirectory(base::FilePath()); | 149 rlz_lib::testing::SetRlzStoreDirectory(base::FilePath()); |
| 147 #endif // defined(OS_POSIX) | 150 #endif // defined(OS_POSIX) |
| 148 } | 151 } |
| 149 | 152 |
| 150 void RlzLibTestNoMachineState::SetUp() { | 153 void RlzLibTestNoMachineState::SetUp() { |
| 151 m_rlz_test_helper_.SetUp(); | 154 m_rlz_test_helper_.SetUp(); |
| 152 } | 155 } |
| 153 | 156 |
| 154 void RlzLibTestNoMachineState::TearDown() { | 157 void RlzLibTestNoMachineState::TearDown() { |
| 155 m_rlz_test_helper_.TearDown(); | 158 m_rlz_test_helper_.TearDown(); |
| 156 } | 159 } |
| 157 | 160 |
| 158 void RlzLibTestBase::SetUp() { | 161 void RlzLibTestBase::SetUp() { |
| 159 RlzLibTestNoMachineState::SetUp(); | 162 RlzLibTestNoMachineState::SetUp(); |
| 160 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
| 161 rlz_lib::CreateMachineState(); | 164 rlz_lib::CreateMachineState(); |
| 162 #endif // defined(OS_WIN) | 165 #endif // defined(OS_WIN) |
| 163 } | 166 } |
| OLD | NEW |