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

Side by Side Diff: chrome_elf/blacklist/test/blacklist_test.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
« no previous file with comments | « chrome/installer/util/shell_util_unittest.cc ('k') | chrome_elf/chrome_elf_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 base::string16 temp = nt::GetTestingOverride(nt::HKCU); 136 base::string16 temp = nt::GetTestingOverride(nt::HKCU);
137 if (!temp.empty()) 137 if (!temp.empty())
138 ASSERT_TRUE(::SetEnvironmentVariableW(L"hkcu_override", temp.c_str())); 138 ASSERT_TRUE(::SetEnvironmentVariableW(L"hkcu_override", temp.c_str()));
139 temp = nt::GetTestingOverride(nt::HKLM); 139 temp = nt::GetTestingOverride(nt::HKLM);
140 if (!temp.empty()) 140 if (!temp.empty())
141 ASSERT_TRUE(::SetEnvironmentVariableW(L"hklm_override", temp.c_str())); 141 ASSERT_TRUE(::SetEnvironmentVariableW(L"hklm_override", temp.c_str()));
142 } 142 }
143 143
144 void SetUp() override { 144 void SetUp() override {
145 base::string16 temp; 145 base::string16 temp;
146 override_manager_.OverrideRegistry(HKEY_CURRENT_USER, &temp); 146 ASSERT_NO_FATAL_FAILURE(
147 override_manager_.OverrideRegistry(HKEY_CURRENT_USER, &temp));
147 ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp)); 148 ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp));
148 149
149 // Make the override path available to our test DLL. 150 // Make the override path available to our test DLL.
150 IpcOverrides(); 151 IpcOverrides();
151 152
152 // Load the main test Dll now. 153 // Load the main test Dll now.
153 // Note: this has to happen after we set up the registry overrides. 154 // Note: this has to happen after we set up the registry overrides.
154 HMODULE dll = nullptr; 155 HMODULE dll = nullptr;
155 dll = ::LoadLibraryW(L"blacklist_test_main_dll.dll"); 156 dll = ::LoadLibraryW(L"blacklist_test_main_dll.dll");
156 if (!dll) 157 if (!dll)
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 &blacklist_state); 380 &blacklist_state);
380 EXPECT_EQ(blacklist_state, blacklist::BLACKLIST_SETUP_RUNNING); 381 EXPECT_EQ(blacklist_state, blacklist::BLACKLIST_SETUP_RUNNING);
381 382
382 DWORD attempt_count = blacklist::kBeaconMaxAttempts; 383 DWORD attempt_count = blacklist::kBeaconMaxAttempts;
383 blacklist_registry_key_->ReadValueDW(blacklist::kBeaconAttemptCount, 384 blacklist_registry_key_->ReadValueDW(blacklist::kBeaconAttemptCount,
384 &attempt_count); 385 &attempt_count);
385 EXPECT_EQ(static_cast<DWORD>(0), attempt_count); 386 EXPECT_EQ(static_cast<DWORD>(0), attempt_count);
386 } 387 }
387 388
388 } // namespace 389 } // namespace
OLDNEW
« no previous file with comments | « chrome/installer/util/shell_util_unittest.cc ('k') | chrome_elf/chrome_elf_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698