Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: chrome_elf/blacklist/test/blacklist_test.cc

Issue 101203010: Add 64-bit support to browser blacklisting (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/environment.h" 5 #include "base/environment.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_native_library.h" 9 #include "base/scoped_native_library.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 EXPECT_FALSE(blacklist::AddDllToBlacklist(L"overflow.dll")); 104 EXPECT_FALSE(blacklist::AddDllToBlacklist(L"overflow.dll"));
105 for (int i = 0; i < blacklist::kTroublesomeDllsMaxCount; ++i) { 105 for (int i = 0; i < blacklist::kTroublesomeDllsMaxCount; ++i) {
106 EXPECT_TRUE(blacklist::RemoveDllFromBlacklist(added_dlls[i].c_str())) << i; 106 EXPECT_TRUE(blacklist::RemoveDllFromBlacklist(added_dlls[i].c_str())) << i;
107 } 107 }
108 EXPECT_FALSE(blacklist::RemoveDllFromBlacklist(L"0.dll")); 108 EXPECT_FALSE(blacklist::RemoveDllFromBlacklist(L"0.dll"));
109 EXPECT_FALSE(blacklist::RemoveDllFromBlacklist(L"63.dll")); 109 EXPECT_FALSE(blacklist::RemoveDllFromBlacklist(L"63.dll"));
110 } 110 }
111 111
112 TEST_F(BlacklistTest, LoadBlacklistedLibrary) { 112 TEST_F(BlacklistTest, LoadBlacklistedLibrary) {
113 // TODO(robertshield): Add 64-bit support.
114 #if !defined(_WIN64)
115 base::FilePath current_dir; 113 base::FilePath current_dir;
116 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &current_dir)); 114 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &current_dir));
117 115
118 // Test that an un-blacklisted DLL can load correctly. 116 // Test that an un-blacklisted DLL can load correctly.
119 base::ScopedNativeLibrary dll1(current_dir.Append(kTestDllName1)); 117 base::ScopedNativeLibrary dll1(current_dir.Append(kTestDllName1));
120 EXPECT_TRUE(dll1.is_valid()); 118 EXPECT_TRUE(dll1.is_valid());
121 dll1.Reset(NULL); 119 dll1.Reset(NULL);
122 120
123 struct TestData { 121 struct TestData {
124 const wchar_t* dll_name; 122 const wchar_t* dll_name;
(...skipping 14 matching lines...) Expand all
139 dll_blacklisted.Reset(NULL); 137 dll_blacklisted.Reset(NULL);
140 138
141 // Remove the DLL from the blacklist. Ensure that it loads and that its 139 // Remove the DLL from the blacklist. Ensure that it loads and that its
142 // entry point was called. 140 // entry point was called.
143 TestDll_RemoveDllFromBlacklist(test_data[i].dll_name); 141 TestDll_RemoveDllFromBlacklist(test_data[i].dll_name);
144 base::ScopedNativeLibrary dll(current_dir.Append(test_data[i].dll_name)); 142 base::ScopedNativeLibrary dll(current_dir.Append(test_data[i].dll_name));
145 EXPECT_TRUE(dll.is_valid()); 143 EXPECT_TRUE(dll.is_valid());
146 EXPECT_NE(0u, ::GetEnvironmentVariable(test_data[i].dll_beacon, NULL, 0)); 144 EXPECT_NE(0u, ::GetEnvironmentVariable(test_data[i].dll_beacon, NULL, 0));
147 dll.Reset(NULL); 145 dll.Reset(NULL);
148 } 146 }
149 #endif
150 } 147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698