| Index: trunk/src/chrome/installer/util/product_state_unittest.cc
|
| ===================================================================
|
| --- trunk/src/chrome/installer/util/product_state_unittest.cc (revision 234626)
|
| +++ trunk/src/chrome/installer/util/product_state_unittest.cc (working copy)
|
| @@ -31,14 +31,15 @@
|
| void MinimallyInstallProduct(const wchar_t* version);
|
|
|
| static BrowserDistribution* dist_;
|
| + static std::wstring temp_key_path_;
|
| bool system_install_;
|
| HKEY overridden_;
|
| - registry_util::RegistryOverrideManager registry_override_manager_;
|
| RegKey clients_;
|
| RegKey client_state_;
|
| };
|
|
|
| BrowserDistribution* ProductStateTest::dist_;
|
| +std::wstring ProductStateTest::temp_key_path_;
|
|
|
| // static
|
| void ProductStateTest::SetUpTestCase() {
|
| @@ -47,10 +48,16 @@
|
| // We'll use Chrome as our test subject.
|
| dist_ = BrowserDistribution::GetSpecificDistribution(
|
| BrowserDistribution::CHROME_BROWSER);
|
| +
|
| + // And we'll play in HKCU here:
|
| + temp_key_path_.assign(RegistryOverrideManager::kTempTestKeyPath)
|
| + .append(1, L'\\')
|
| + .append(L"ProductStateTest");
|
| }
|
|
|
| // static
|
| void ProductStateTest::TearDownTestCase() {
|
| + temp_key_path_.clear();
|
| dist_ = NULL;
|
|
|
| testing::Test::TearDownTestCase();
|
| @@ -66,9 +73,12 @@
|
| // Override for test purposes. We don't use ScopedRegistryKeyOverride
|
| // directly because it doesn't suit itself to our use here.
|
| RegKey temp_key;
|
| + EXPECT_EQ(ERROR_SUCCESS,
|
| + temp_key.Create(HKEY_CURRENT_USER, temp_key_path_.c_str(),
|
| + KEY_ALL_ACCESS));
|
| + EXPECT_EQ(ERROR_SUCCESS,
|
| + ::RegOverridePredefKey(overridden_, temp_key.Handle()));
|
|
|
| - registry_override_manager_.OverrideRegistry(overridden_, L"ProductStateTest");
|
| -
|
| EXPECT_EQ(ERROR_SUCCESS,
|
| clients_.Create(overridden_, dist_->GetVersionKey().c_str(),
|
| KEY_ALL_ACCESS));
|
| @@ -81,9 +91,13 @@
|
| // Done with the keys.
|
| client_state_.Close();
|
| clients_.Close();
|
| + EXPECT_EQ(ERROR_SUCCESS, ::RegOverridePredefKey(overridden_, NULL));
|
| overridden_ = NULL;
|
| system_install_ = false;
|
|
|
| + // Shotgun approach to clearing out data we may have written.
|
| + RegistryOverrideManager::DeleteAllTempKeys();
|
| +
|
| testing::Test::TearDown();
|
| }
|
|
|
|
|