Chromium Code Reviews| Index: chrome/browser/chrome_elf_init_unittest_win.cc |
| diff --git a/chrome/browser/chrome_elf_init_unittest_win.cc b/chrome/browser/chrome_elf_init_unittest_win.cc |
| index 441f73665707f1f8dbc3bddc08729fb3ef70f91c..35e86adac834024896d63fe09770139ae2d77e4f 100644 |
| --- a/chrome/browser/chrome_elf_init_unittest_win.cc |
| +++ b/chrome/browser/chrome_elf_init_unittest_win.cc |
| @@ -113,55 +113,32 @@ TEST_F(ChromeBlacklistTrialTest, VerifyFirstRun) { |
| ASSERT_EQ(version, GetBlacklistVersion()); |
| } |
| -TEST_F(ChromeBlacklistTrialTest, SetupFailed) { |
| - // Set the registry to indicate that the blacklist setup is running, |
| - // which means it failed to run correctly last time for this version. |
| +TEST_F(ChromeBlacklistTrialTest, BlacklistFailed) { |
| + // Ensure when the blacklist set up failed we set the state to disabled for |
| + // future runs. |
| blacklist_registry_key_->WriteValue(blacklist::kBeaconVersion, |
| TEXT(CHROME_VERSION_STRING)); |
| blacklist_registry_key_->WriteValue(blacklist::kBeaconState, |
| - blacklist::BLACKLIST_SETUP_RUNNING); |
| - |
| - BrowserBlacklistBeaconSetup(); |
| - |
| - // Since the blacklist setup failed, it should now be disabled. |
| - ASSERT_EQ(blacklist::BLACKLIST_DISABLED, GetBlacklistState()); |
| -} |
| - |
| -TEST_F(ChromeBlacklistTrialTest, ThunkSetupFailed) { |
| - // Set the registry to indicate that the blacklist thunk setup is running, |
| - // which means it failed to run correctly last time for this version. |
| - blacklist_registry_key_->WriteValue(blacklist::kBeaconVersion, |
| - TEXT(CHROME_VERSION_STRING)); |
| - blacklist_registry_key_->WriteValue(blacklist::kBeaconState, |
| - blacklist::BLACKLIST_THUNK_SETUP); |
| - |
| - BrowserBlacklistBeaconSetup(); |
| - |
| - // Since the blacklist thunk setup failed, it should now be disabled. |
| - ASSERT_EQ(blacklist::BLACKLIST_DISABLED, GetBlacklistState()); |
| -} |
| - |
| -TEST_F(ChromeBlacklistTrialTest, InterceptionFailed) { |
| - // Set the registry to indicate that an interception is running, |
| - // which means it failed to run correctly last time for this version. |
| - blacklist_registry_key_->WriteValue(blacklist::kBeaconVersion, |
| - TEXT(CHROME_VERSION_STRING)); |
| - blacklist_registry_key_->WriteValue(blacklist::kBeaconState, |
| - blacklist::BLACKLIST_INTERCEPTING); |
| + blacklist::BLACKLIST_SETUP_FAILED); |
| BrowserBlacklistBeaconSetup(); |
| - // Since an interception failed, the blacklist should now be disabled. |
| - ASSERT_EQ(blacklist::BLACKLIST_DISABLED, GetBlacklistState()); |
| + DWORD blacklist_state = blacklist::BLACKLIST_STATE_MAX; |
| + blacklist_registry_key_->ReadValueDW(blacklist::kBeaconState, |
| + &blacklist_state); |
| + ASSERT_EQ(blacklist::BLACKLIST_DISABLED, blacklist_state); |
| } |
| TEST_F(ChromeBlacklistTrialTest, VersionChanged) { |
| - // Mark the blacklist as disabled for an older version, so it should |
| - // get enabled for this new version. |
| + // Mark the blacklist as disabled for an older version, it should |
| + // get enabled for this new version. Also record a non-zero number of |
| + // setup failures, this should be reset to zero. |
|
csharp
2014/06/10 14:07:02
nit: this -> which
krstnmnlsn
2014/06/10 22:03:26
Done.
|
| blacklist_registry_key_->WriteValue(blacklist::kBeaconVersion, |
| L"old_version"); |
| blacklist_registry_key_->WriteValue(blacklist::kBeaconState, |
| blacklist::BLACKLIST_DISABLED); |
| + blacklist_registry_key_->WriteValue(blacklist::kBeaconAttemptCount, |
| + blacklist::kBeaconMaxAttempts); |
| BrowserBlacklistBeaconSetup(); |
| @@ -171,4 +148,10 @@ TEST_F(ChromeBlacklistTrialTest, VersionChanged) { |
| chrome::VersionInfo version_info; |
| base::string16 expected_version(base::UTF8ToUTF16(version_info.Version())); |
| ASSERT_EQ(expected_version, GetBlacklistVersion()); |
| + |
| + // The counter should be reset. |
| + DWORD attempt_count = blacklist::kBeaconMaxAttempts; |
| + blacklist_registry_key_->ReadValueDW(blacklist::kBeaconAttemptCount, |
| + &attempt_count); |
| + ASSERT_EQ(static_cast<DWORD>(0), attempt_count); |
| } |