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 c75edc05ace4d199d79babe415702142b1b4cf95..7ffe2ba2742789e2bd03eec076beaca0fa78501f 100644 |
| --- a/chrome/browser/chrome_elf_init_unittest_win.cc |
| +++ b/chrome/browser/chrome_elf_init_unittest_win.cc |
| @@ -5,13 +5,17 @@ |
| #include "chrome/browser/chrome_elf_init_win.h" |
| #include "base/basictypes.h" |
| +#include "base/files/file_path.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/metrics/field_trial.h" |
| +#include "base/path_service.h" |
| +#include "base/scoped_native_library.h" |
| #include "base/strings/string16.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/test/test_reg_util_win.h" |
| #include "chrome/common/chrome_version_info.h" |
| +#include "chrome_elf/blacklist/blacklist.h" |
| #include "chrome_elf/chrome_elf_constants.h" |
| #include "components/variations/entropy_provider.h" |
| #include "components/variations/variations_associated_data.h" |
| @@ -21,6 +25,7 @@ |
| namespace { |
| const char kBrowserBlacklistTrialEnabledGroupName[] = "Enabled"; |
| +const wchar_t kTestDllName[] = L"blacklist_test_dll_1.dll"; |
| class ChromeBlacklistTrialTest : public testing::Test { |
| protected: |
| @@ -195,4 +200,40 @@ TEST_F(ChromeBlacklistTrialTest, AddFinchBlacklistToRegistry) { |
| } |
| } |
| +TEST_F(ChromeBlacklistTrialTest, TestBlacklistBypass) { |
| + base::FilePath current_dir; |
| + ASSERT_TRUE(PathService::Get(base::DIR_EXE, ¤t_dir)); |
| + |
| + // Load test dll. |
| + base::ScopedNativeLibrary dll1(current_dir.Append(kTestDllName)); |
| + |
| + // Call RetrieveBlacklistedModules, test dll should not be in the list. |
| + std::vector<base::string16> module_names; |
| + RetrieveBlacklistedModules(&module_names); |
|
csharp
2014/08/05 21:08:59
Shouldn't this just return an empty list? Could we
robertshield
2014/08/06 16:38:31
Done (also added logging to help identify any non-
|
| + std::vector<base::string16>::const_iterator module_iter(module_names.begin()); |
| + for (; module_iter != module_names.end(); ++module_iter) { |
| + EXPECT_STRNE( |
| + StringToLowerASCII( |
| + base::FilePath(*module_iter).BaseName().value()).c_str(), |
| + kTestDllName); |
| + } |
| + |
| + // Add test dll to blacklist |
| + blacklist::AddDllToBlacklist(kTestDllName); |
| + |
| + // Call RetrieveBlacklistedModules, check that the test dll appears in list. |
| + module_names.clear(); |
| + EXPECT_TRUE(RetrieveBlacklistedModules(&module_names)); |
| + bool found_test_module = false; |
|
csharp
2014/08/05 21:08:59
lines 227-236 can probably be replace by just chec
robertshield
2014/08/06 16:38:32
Done.
|
| + for (module_iter = module_names.begin(); module_iter != module_names.end(); |
| + ++module_iter) { |
| + if (StringToLowerASCII( |
| + base::FilePath(*module_iter).BaseName().value()) == kTestDllName) { |
| + found_test_module = true; |
| + break; |
| + } |
| + } |
| + EXPECT_TRUE(found_test_module); |
| +} |
| + |
| } // namespace |