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

Unified Diff: chrome_elf/blacklist/test/blacklist_test.cc

Issue 2345913003: [chrome_elf] NTRegistry - added wow64 redirection support. (Closed)
Patch Set: Code review fixes, part 3. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome_elf/blacklist/test/blacklist_test.cc
diff --git a/chrome_elf/blacklist/test/blacklist_test.cc b/chrome_elf/blacklist/test/blacklist_test.cc
index b970057e0d767dc8104e5f87a5c6842fecc0fef7..3ede32f01270c10b1eead590f9579b0cc705f42a 100644
--- a/chrome_elf/blacklist/test/blacklist_test.cc
+++ b/chrome_elf/blacklist/test/blacklist_test.cc
@@ -133,20 +133,21 @@ class BlacklistTest : public testing::Test {
// process-specific environment variables, for our test DLLs to access.
// This will only work as long as the IPC is within the same process.
void IpcOverrides() {
- if (::wcslen(nt::HKCU_override) != 0) {
- ASSERT_TRUE(
- ::SetEnvironmentVariableW(L"hkcu_override", nt::HKCU_override));
+ base::string16 temp;
+ nt::GetTestingOverride(nt::HKCU, &temp);
+ if (temp.length() != 0) {
grt (UTC plus 2) 2016/09/30 09:32:16 nit: if (!temp.empty()) nit: omit braces :-)
penny 2016/10/01 01:44:25 Can you tell what the coding standard was in my pr
grt (UTC plus 2) 2016/10/02 20:10:54 https://groups.google.com/a/chromium.org/d/msg/chr
+ ASSERT_TRUE(::SetEnvironmentVariableW(L"hkcu_override", temp.c_str()));
}
- if (::wcslen(nt::HKLM_override) != 0) {
- ASSERT_TRUE(
- ::SetEnvironmentVariableW(L"hklm_override", nt::HKLM_override));
+ nt::GetTestingOverride(nt::HKLM, &temp);
+ if (temp.length() != 0) {
+ ASSERT_TRUE(::SetEnvironmentVariableW(L"hklm_override", temp.c_str()));
}
}
void SetUp() override {
base::string16 temp;
override_manager_.OverrideRegistry(HKEY_CURRENT_USER, &temp);
- ::wcsncpy(nt::HKCU_override, temp.c_str(), nt::g_kRegMaxPathLen - 1);
+ ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp));
// Make the override path available to our test DLL.
IpcOverrides();
@@ -203,10 +204,10 @@ class BlacklistTest : public testing::Test {
TestDll_RemoveDllFromBlacklist(kTestDllName1);
TestDll_RemoveDllFromBlacklist(kTestDllName2);
TestDll_RemoveDllFromBlacklist(kTestDllName3);
- }
- // A scoped temporary directory to be destroyed with this test.
- base::ScopedTempDir reg_override_dir_;
+ base::string16 temp = L"";
grt (UTC plus 2) 2016/09/30 09:32:16 nit: omit the assignment. just let |temp| be defau
penny 2016/10/01 01:44:25 Done.
+ ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp));
+ }
};
TEST_F(BlacklistTest, Beacon) {

Powered by Google App Engine
This is Rietveld 408576698