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

Side by Side Diff: chrome_elf/nt_registry/nt_registry_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_elf/nt_registry/nt_registry.h" 5 #include "chrome_elf/nt_registry/nt_registry.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <rpc.h> 8 #include <rpc.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 //------------------------------------------------------------------------------ 287 //------------------------------------------------------------------------------
288 // NtRegistryTest class 288 // NtRegistryTest class
289 // 289 //
290 // Only use this class for tests that need testing registry redirection. 290 // Only use this class for tests that need testing registry redirection.
291 //------------------------------------------------------------------------------ 291 //------------------------------------------------------------------------------
292 292
293 class NtRegistryTest : public testing::Test { 293 class NtRegistryTest : public testing::Test {
294 protected: 294 protected:
295 void SetUp() override { 295 void SetUp() override {
296 base::string16 temp; 296 base::string16 temp;
297 override_manager_.OverrideRegistry(HKEY_CURRENT_USER, &temp); 297 ASSERT_NO_FATAL_FAILURE(
298 override_manager_.OverrideRegistry(HKEY_CURRENT_USER, &temp));
298 ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp)); 299 ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp));
299 override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE, &temp); 300 ASSERT_NO_FATAL_FAILURE(
301 override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE, &temp));
300 ASSERT_TRUE(nt::SetTestingOverride(nt::HKLM, temp)); 302 ASSERT_TRUE(nt::SetTestingOverride(nt::HKLM, temp));
301 } 303 }
302 304
303 void TearDown() override { 305 void TearDown() override {
304 base::string16 temp; 306 base::string16 temp;
305 ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp)); 307 ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp));
306 ASSERT_TRUE(nt::SetTestingOverride(nt::HKLM, temp)); 308 ASSERT_TRUE(nt::SetTestingOverride(nt::HKLM, temp));
307 } 309 }
308 310
309 private: 311 private:
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 nt::CloseRegKey(key_handle); 458 nt::CloseRegKey(key_handle);
457 459
458 // Subkey path can be null. 460 // Subkey path can be null.
459 ASSERT_TRUE(nt::CreateRegKey(nt::HKCU, nullptr, KEY_ALL_ACCESS, &key_handle)); 461 ASSERT_TRUE(nt::CreateRegKey(nt::HKCU, nullptr, KEY_ALL_ACCESS, &key_handle));
460 ASSERT_NE(key_handle, INVALID_HANDLE_VALUE); 462 ASSERT_NE(key_handle, INVALID_HANDLE_VALUE);
461 ASSERT_NE(key_handle, nullptr); 463 ASSERT_NE(key_handle, nullptr);
462 nt::CloseRegKey(key_handle); 464 nt::CloseRegKey(key_handle);
463 } 465 }
464 466
465 } // namespace 467 } // namespace
OLDNEW
« no previous file with comments | « chrome_elf/chrome_elf_util_unittest.cc ('k') | components/browser_watcher/exit_code_watcher_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698