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..7b3311834e5347710afd500d847f122036a80286 100644 |
| --- a/chrome/browser/chrome_elf_init_unittest_win.cc |
| +++ b/chrome/browser/chrome_elf_init_unittest_win.cc |
| @@ -14,9 +14,14 @@ |
| #include "chrome/common/chrome_version_info.h" |
| #include "chrome_elf/chrome_elf_constants.h" |
| #include "components/variations/entropy_provider.h" |
| +#include "components/variations/variations_associated_data.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "version.h" // NOLINT |
| +namespace { |
| + |
| +const char kBrowserBlacklistTrialEnabledGroupName[] = "Enabled"; |
| + |
| class ChromeBlacklistTrialTest : public testing::Test { |
| protected: |
| ChromeBlacklistTrialTest() {} |
| @@ -76,7 +81,6 @@ TEST_F(ChromeBlacklistTrialTest, DefaultRun) { |
| ASSERT_EQ(version, GetBlacklistVersion()); |
| } |
| - |
| // Ensure that the blacklist is disabled for any users in the |
| // "BlacklistDisabled" finch group. |
| TEST_F(ChromeBlacklistTrialTest, BlacklistDisabledRun) { |
| @@ -172,3 +176,44 @@ TEST_F(ChromeBlacklistTrialTest, VersionChanged) { |
| base::string16 expected_version(base::UTF8ToUTF16(version_info.Version())); |
| ASSERT_EQ(expected_version, GetBlacklistVersion()); |
| } |
| + |
| +TEST_F(ChromeBlacklistTrialTest, AddFinchBlacklistToRegistry) { |
| + // Create the field trial with the blacklist enabled group. |
| + base::FieldTrialList field_trial_list( |
| + new metrics::SHA1EntropyProvider("test")); |
| + |
| + scoped_refptr<base::FieldTrial> trial(base::FieldTrialList::CreateFieldTrial( |
| + kBrowserBlacklistTrialName, kBrowserBlacklistTrialEnabledGroupName)); |
| + |
| + // Set up the trial with the desired parameters. |
| + std::map<std::string, std::string> desired_params; |
| + desired_params["TestDllName1"] = "TestDll1.dll"; |
| + desired_params["TestDllName2"] = "TestDll2.dll"; |
| + |
| + chrome_variations::AssociateVariationParams( |
| + kBrowserBlacklistTrialName, |
| + kBrowserBlacklistTrialEnabledGroupName, |
| + desired_params); |
| + |
| + // This should add the dlls in those parameters to the registry. |
| + AddFinchBlacklistToRegistry(); |
| + |
| + // Check that the set of values in the registry is the same |
|
csharp
2014/06/03 21:11:36
The comment might be clearer as "Check that all th
krstnmnlsn
2014/06/04 16:55:44
Done.
|
| + // as those in desired_params by comparing size and containment one way. |
| + base::win::RegKey finch_blacklist_registry_key( |
| + HKEY_CURRENT_USER, |
| + blacklist::kRegistryFinchListPath, |
| + KEY_QUERY_VALUE | KEY_SET_VALUE); |
| + |
| + ASSERT_EQ(desired_params.size(), |
| + finch_blacklist_registry_key.GetValueCount()); |
| + |
| + std::map<std::string, std::string>::iterator it = desired_params.begin(); |
| + |
| + for (; it != desired_params.end(); ++it) { |
| + std::wstring name = base::UTF8ToWide(it->first); |
| + ASSERT_TRUE(finch_blacklist_registry_key.HasValue(name.c_str())); |
| + } |
| +} |
| + |
| +} // namespace |