| Index: chrome_elf/blacklist/test/blacklist_test.cc
|
| diff --git a/chrome_elf/blacklist/test/blacklist_test.cc b/chrome_elf/blacklist/test/blacklist_test.cc
|
| index a0c55f2f5bba3862c3830a0b5649a48271474b1d..b970057e0d767dc8104e5f87a5c6842fecc0fef7 100644
|
| --- a/chrome_elf/blacklist/test/blacklist_test.cc
|
| +++ b/chrome_elf/blacklist/test/blacklist_test.cc
|
| @@ -37,7 +37,6 @@ extern const wchar_t* kEnvVars[];
|
| namespace {
|
|
|
| // Functions we need from blacklist_test_main_dll.dll
|
| -typedef void (*TestDll_AddDllsFromRegistryToBlacklistFunction)();
|
| typedef bool (*TestDll_AddDllToBlacklistFunction)(const wchar_t* dll_name);
|
| typedef int (*TestDll_BlacklistSizeFunction)();
|
| typedef void (*TestDll_BlockedDllFunction)(size_t blocked_index);
|
| @@ -49,8 +48,6 @@ typedef bool (*TestDll_SuccessfullyBlockedFunction)(
|
| int* size);
|
| typedef void (*InitTestDllFunction)();
|
|
|
| -TestDll_AddDllsFromRegistryToBlacklistFunction
|
| - TestDll_AddDllsFromRegistryToBlacklist = nullptr;
|
| TestDll_AddDllToBlacklistFunction TestDll_AddDllToBlacklist = nullptr;
|
| TestDll_BlacklistSizeFunction TestDll_BlacklistSize = nullptr;
|
| TestDll_BlockedDllFunction TestDll_BlockedDll = nullptr;
|
| @@ -160,9 +157,6 @@ class BlacklistTest : public testing::Test {
|
| dll = ::LoadLibraryW(L"blacklist_test_main_dll.dll");
|
| if (!dll)
|
| return;
|
| - TestDll_AddDllsFromRegistryToBlacklist =
|
| - reinterpret_cast<TestDll_AddDllsFromRegistryToBlacklistFunction>(
|
| - ::GetProcAddress(dll, "TestDll_AddDllsFromRegistryToBlacklist"));
|
| TestDll_AddDllToBlacklist =
|
| reinterpret_cast<TestDll_AddDllToBlacklistFunction>(
|
| ::GetProcAddress(dll, "TestDll_AddDllToBlacklist"));
|
| @@ -184,11 +178,10 @@ class BlacklistTest : public testing::Test {
|
| ::GetProcAddress(dll, "TestDll_SuccessfullyBlocked"));
|
| InitTestDll = reinterpret_cast<InitTestDllFunction>(
|
| ::GetProcAddress(dll, "InitTestDll"));
|
| - if (!TestDll_AddDllsFromRegistryToBlacklist || !TestDll_AddDllToBlacklist ||
|
| - !TestDll_BlacklistSize || !TestDll_BlockedDll ||
|
| - !TestDll_GetBlacklistIndex || !TestDll_IsBlacklistInitialized ||
|
| - !TestDll_RemoveDllFromBlacklist || !TestDll_SuccessfullyBlocked ||
|
| - !InitTestDll)
|
| + if (!TestDll_AddDllToBlacklist || !TestDll_BlacklistSize ||
|
| + !TestDll_BlockedDll || !TestDll_GetBlacklistIndex ||
|
| + !TestDll_IsBlacklistInitialized || !TestDll_RemoveDllFromBlacklist ||
|
| + !TestDll_SuccessfullyBlocked || !InitTestDll)
|
| return;
|
|
|
| // We have to call this exported function every time this test setup runs.
|
| @@ -316,42 +309,6 @@ TEST_F(BlacklistTest, LoadBlacklistedLibrary) {
|
| CheckBlacklistedDllsNotLoaded();
|
| }
|
|
|
| -TEST_F(BlacklistTest, AddDllsFromRegistryToBlacklist) {
|
| - // Ensure that the blacklist is loaded.
|
| - ASSERT_TRUE(TestDll_IsBlacklistInitialized());
|
| -
|
| - // Delete the finch registry key to clear its values.
|
| - base::win::RegKey key(HKEY_CURRENT_USER,
|
| - blacklist::kRegistryFinchListPath,
|
| - KEY_QUERY_VALUE | KEY_SET_VALUE);
|
| - key.DeleteKey(L"");
|
| -
|
| - // Add the test dlls to the registry.
|
| - // (REG_MULTI_SZ: eos separated, double null terminated.)
|
| - base::win::RegKey finch_blacklist_registry_key(
|
| - HKEY_CURRENT_USER,
|
| - blacklist::kRegistryFinchListPath,
|
| - KEY_QUERY_VALUE | KEY_SET_VALUE);
|
| -
|
| - std::vector<wchar_t>(reg_buffer);
|
| - for (size_t i = 0; i < arraysize(test_data); ++i) {
|
| - if (reg_buffer.size() > 0)
|
| - reg_buffer.push_back(L'\0');
|
| - const wchar_t* dll = test_data[i].dll_name;
|
| - // Append the name, not including terminator.
|
| - reg_buffer.insert(reg_buffer.end(), dll, dll + ::wcslen(dll));
|
| - }
|
| - reg_buffer.push_back(L'\0');
|
| - reg_buffer.push_back(L'\0');
|
| -
|
| - finch_blacklist_registry_key.WriteValue(
|
| - blacklist::kRegistryFinchListValueName, reg_buffer.data(),
|
| - (DWORD)(reg_buffer.size() * sizeof(wchar_t)), REG_MULTI_SZ);
|
| -
|
| - TestDll_AddDllsFromRegistryToBlacklist();
|
| - CheckBlacklistedDllsNotLoaded();
|
| -}
|
| -
|
| void TestResetBeacon(std::unique_ptr<base::win::RegKey>& key,
|
| DWORD input_state,
|
| DWORD expected_output_state) {
|
|
|