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

Unified Diff: rlz/test/rlz_test_helpers.cc

Issue 10642009: Add a regenerate button to regenerate the password in Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync and Merge. Created 8 years, 6 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
« no previous file with comments | « rlz/test/rlz_test_helpers.h ('k') | rlz/test/rlz_unittest_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: rlz/test/rlz_test_helpers.cc
diff --git a/rlz/test/rlz_test_helpers.cc b/rlz/test/rlz_test_helpers.cc
deleted file mode 100644
index 1a1870a058abaa6671601e06ead4a84508fa79a8..0000000000000000000000000000000000000000
--- a/rlz/test/rlz_test_helpers.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// Main entry point for all unit tests.
-
-#include "rlz_test_helpers.h"
-
-#include "rlz/lib/rlz_lib.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-#if defined(OS_WIN)
-#include <shlwapi.h>
-#include "base/win/registry.h"
-#include "rlz/win/lib/rlz_lib.h"
-#elif defined(OS_MACOSX)
-#include "base/file_path.h"
-#include "rlz/lib/rlz_value_store.h"
-#endif
-
-#if defined(OS_WIN)
-namespace {
-
-const wchar_t* kHKCUReplacement = L"Software\\Google\\RlzUtilUnittest\\HKCU";
-const wchar_t* kHKLMReplacement = L"Software\\Google\\RlzUtilUnittest\\HKLM";
-
-void OverrideRegistryHives() {
- // Wipe the keys we redirect to.
- // This gives us a stable run, even in the presence of previous
- // crashes or failures.
- LSTATUS err = SHDeleteKey(HKEY_CURRENT_USER, kHKCUReplacement);
- EXPECT_TRUE(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND);
- err = SHDeleteKey(HKEY_CURRENT_USER, kHKLMReplacement);
- EXPECT_TRUE(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND);
-
- // Create the keys we're redirecting HKCU and HKLM to.
- base::win::RegKey hkcu;
- base::win::RegKey hklm;
- ASSERT_EQ(ERROR_SUCCESS,
- hkcu.Create(HKEY_CURRENT_USER, kHKCUReplacement, KEY_READ));
- ASSERT_EQ(ERROR_SUCCESS,
- hklm.Create(HKEY_CURRENT_USER, kHKLMReplacement, KEY_READ));
-
- rlz_lib::InitializeTempHivesForTesting(hklm, hkcu);
-
- // And do the switcharoo.
- ASSERT_EQ(ERROR_SUCCESS,
- ::RegOverridePredefKey(HKEY_CURRENT_USER, hkcu.Handle()));
- ASSERT_EQ(ERROR_SUCCESS,
- ::RegOverridePredefKey(HKEY_LOCAL_MACHINE, hklm.Handle()));
-}
-
-void UndoOverrideRegistryHives() {
- // Undo the redirection.
- EXPECT_EQ(ERROR_SUCCESS, ::RegOverridePredefKey(HKEY_CURRENT_USER, NULL));
- EXPECT_EQ(ERROR_SUCCESS, ::RegOverridePredefKey(HKEY_LOCAL_MACHINE, NULL));
-}
-
-} // namespace
-#endif // defined(OS_WIN)
-
-
-void RlzLibTestNoMachineState::SetUp() {
-#if defined(OS_WIN)
- OverrideRegistryHives();
-#elif defined(OS_MACOSX)
- base::mac::ScopedNSAutoreleasePool pool;
- ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- rlz_lib::testing::SetRlzStoreDirectory(temp_dir_.path());
-#endif // defined(OS_WIN)
-}
-
-void RlzLibTestNoMachineState::TearDown() {
-#if defined(OS_WIN)
- UndoOverrideRegistryHives();
-#elif defined(OS_MACOSX)
- rlz_lib::testing::SetRlzStoreDirectory(FilePath());
-#endif // defined(OS_WIN)
-}
-
-void RlzLibTestBase::SetUp() {
- RlzLibTestNoMachineState::SetUp();
-#if defined(OS_WIN)
- rlz_lib::CreateMachineState();
-#endif // defined(OS_WIN)
-}
« no previous file with comments | « rlz/test/rlz_test_helpers.h ('k') | rlz/test/rlz_unittest_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698