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..f98ee0817adce1a179da65ecee6fa9bd796184ed 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,43 @@ 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 all the values in desired_params were added to the registry. |
+ 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()); |
+ |
+ for (std::map<std::string, std::string>::iterator it = desired_params.begin(); |
+ it != desired_params.end(); |
+ ++it) { |
+ std::wstring name = base::UTF8ToWide(it->first); |
+ ASSERT_TRUE(finch_blacklist_registry_key.HasValue(name.c_str())); |
+ } |
+} |
+ |
+} // namespace |