diff options
author | noamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 00:07:02 +0000 |
---|---|---|
committer | noamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 00:07:02 +0000 |
commit | 86ba1fe0d2582adf113f68a32532277017c4449f (patch) | |
tree | 32b52af42748b2a397620a1347f27ac1754d63d7 /chrome_elf/blacklist/test | |
parent | 8261d96a668f541bfe152c172f670697681e3bcc (diff) | |
download | chromium_src-86ba1fe0d2582adf113f68a32532277017c4449f.zip chromium_src-86ba1fe0d2582adf113f68a32532277017c4449f.tar.gz chromium_src-86ba1fe0d2582adf113f68a32532277017c4449f.tar.bz2 |
Revert 243967 "Use a Finch Experiment to control the Browser Bla..."
> Use a Finch Experiment to control the Browser Blacklist
>
> Also increase the states stored in the register to prevent
> the setup code from running multiple times per version if
> it fails to start one time.
>
> BUG=329023
>
> Review URL: https://codereview.chromium.org/120963002
TBR=csharp@chromium.org
Review URL: https://codereview.chromium.org/132043005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244026 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_elf/blacklist/test')
-rw-r--r-- | chrome_elf/blacklist/test/blacklist_test.cc | 59 |
1 files changed, 14 insertions, 45 deletions
diff --git a/chrome_elf/blacklist/test/blacklist_test.cc b/chrome_elf/blacklist/test/blacklist_test.cc index 8666a81..dbb662f 100644 --- a/chrome_elf/blacklist/test/blacklist_test.cc +++ b/chrome_elf/blacklist/test/blacklist_test.cc @@ -14,7 +14,6 @@ #include "chrome_elf/blacklist/blacklist.h" #include "chrome_elf/blacklist/test/blacklist_test_main_dll.h" #include "testing/gtest/include/gtest/gtest.h" -#include "version.h" // NOLINT const wchar_t kTestDllName1[] = L"blacklist_test_dll_1.dll"; const wchar_t kTestDllName2[] = L"blacklist_test_dll_2.dll"; @@ -38,6 +37,9 @@ class BlacklistTest : public testing::Test { virtual void SetUp() { // Force an import from blacklist_test_main_dll. InitBlacklistTestDll(); + + // Ensure that the beacon state starts off cleared. + blacklist::ClearBeacon(); } virtual void TearDown() { @@ -50,50 +52,17 @@ TEST_F(BlacklistTest, Beacon) { registry_util::RegistryOverrideManager override_manager; override_manager.OverrideRegistry(HKEY_CURRENT_USER, L"beacon_test"); - // Ensure that the beacon state starts off enabled for this version. - DWORD blacklist_state = blacklist::BLACKLIST_ENABLED; - LONG result = ::RegSetKeyValue(HKEY_CURRENT_USER, - blacklist::kRegistryBeaconPath, - blacklist::kBeaconState, - REG_DWORD, - &blacklist_state, - sizeof(blacklist_state)); - ASSERT_EQ(result, ERROR_SUCCESS); - - result = ::RegSetKeyValue(HKEY_CURRENT_USER, - blacklist::kRegistryBeaconPath, - blacklist::kBeaconVersion, - REG_SZ, - TEXT(CHROME_VERSION_STRING), - sizeof(TEXT(CHROME_VERSION_STRING))); - ASSERT_EQ(result, ERROR_SUCCESS); - - // First call should find the beacon and reset it. - EXPECT_TRUE(blacklist::ResetBeacon()); - - // First call should succeed as the beacon is enabled. - EXPECT_TRUE(blacklist::LeaveSetupBeacon()); - - // Second call should fail indicating the beacon wasn't set as enabled. - EXPECT_FALSE(blacklist::LeaveSetupBeacon()); - - // Resetting the beacon should work when setup beacon is present. - EXPECT_TRUE(blacklist::ResetBeacon()); - - // Change the version and ensure that the setup fails due to the version - // mismatch. - base::string16 different_version(L"other_version"); - ASSERT_NE(different_version, TEXT(CHROME_VERSION_STRING)); - - result = ::RegSetKeyValue(HKEY_CURRENT_USER, - blacklist::kRegistryBeaconPath, - blacklist::kBeaconVersion, - REG_SZ, - different_version.c_str(), - sizeof(different_version)); - ASSERT_EQ(result, ERROR_SUCCESS); - - EXPECT_FALSE(blacklist::LeaveSetupBeacon()); + // First call should succeed as the beacon is newly created. + EXPECT_TRUE(blacklist::CreateBeacon()); + + // Second call should fail indicating the beacon already existed. + EXPECT_FALSE(blacklist::CreateBeacon()); + + // First call should find the beacon and delete it. + EXPECT_TRUE(blacklist::ClearBeacon()); + + // Second call should fail to find the beacon and delete it. + EXPECT_FALSE(blacklist::ClearBeacon()); } TEST_F(BlacklistTest, AddAndRemoveModules) { |