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

Side by Side Diff: chrome/install_static/product_install_details_unittest.cc

Issue 2692843002: Fail tests fast if overriding the Windows registry fails. (Closed)
Patch Set: sync to position 450085 Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/install_static/product_install_details.h" 5 #include "chrome/install_static/product_install_details.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } // namespace 166 } // namespace
167 167
168 // Test that MakeProductDetails properly sniffs out an install's details. 168 // Test that MakeProductDetails properly sniffs out an install's details.
169 class MakeProductDetailsTest : public testing::TestWithParam<TestData> { 169 class MakeProductDetailsTest : public testing::TestWithParam<TestData> {
170 protected: 170 protected:
171 MakeProductDetailsTest() 171 MakeProductDetailsTest()
172 : test_data_(GetParam()), 172 : test_data_(GetParam()),
173 root_key_(test_data_.system_level ? HKEY_LOCAL_MACHINE 173 root_key_(test_data_.system_level ? HKEY_LOCAL_MACHINE
174 : HKEY_CURRENT_USER), 174 : HKEY_CURRENT_USER),
175 nt_root_key_(test_data_.system_level ? nt::HKLM : nt::HKCU) { 175 nt_root_key_(test_data_.system_level ? nt::HKLM : nt::HKCU) {
176 base::string16 path;
177 override_manager_.OverrideRegistry(root_key_, &path);
178 nt::SetTestingOverride(nt_root_key_, path);
179 } 176 }
180 177
181 ~MakeProductDetailsTest() { 178 ~MakeProductDetailsTest() {
182 nt::SetTestingOverride(nt_root_key_, base::string16()); 179 nt::SetTestingOverride(nt_root_key_, base::string16());
183 } 180 }
184 181
182 void SetUp() override {
183 base::string16 path;
184 ASSERT_NO_FATAL_FAILURE(
185 override_manager_.OverrideRegistry(root_key_, &path));
186 nt::SetTestingOverride(nt_root_key_, path);
187 }
188
185 const TestData& test_data() const { return test_data_; } 189 const TestData& test_data() const { return test_data_; }
186 190
187 void SetAp(const wchar_t* value) { 191 void SetAp(const wchar_t* value) {
188 ASSERT_THAT(base::win::RegKey(root_key_, GetClientStateKeyPath().c_str(), 192 ASSERT_THAT(base::win::RegKey(root_key_, GetClientStateKeyPath().c_str(),
189 KEY_WOW64_32KEY | KEY_SET_VALUE) 193 KEY_WOW64_32KEY | KEY_SET_VALUE)
190 .WriteValue(L"ap", value), 194 .WriteValue(L"ap", value),
191 Eq(ERROR_SUCCESS)); 195 Eq(ERROR_SUCCESS));
192 } 196 }
193 197
194 private: 198 private:
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 EXPECT_THAT(details->channel(), StrEq(test_data().channel)); 288 EXPECT_THAT(details->channel(), StrEq(test_data().channel));
285 } 289 }
286 } 290 }
287 } 291 }
288 292
289 INSTANTIATE_TEST_CASE_P(All, 293 INSTANTIATE_TEST_CASE_P(All,
290 MakeProductDetailsTest, 294 MakeProductDetailsTest,
291 testing::ValuesIn(kTestData)); 295 testing::ValuesIn(kTestData));
292 296
293 } // namespace install_static 297 } // namespace install_static
OLDNEW
« no previous file with comments | « chrome/install_static/install_util_unittest.cc ('k') | chrome/install_static/user_data_dir_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698