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

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: responding to comments Created 6 years, 10 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
« no previous file with comments | « chrome_elf/blacklist/blacklist_interceptions.cc ('k') | sandbox/win/src/service_resolver_64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_native_library.h" 10 #include "base/scoped_native_library.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 EXPECT_FALSE(blacklist::AddDllToBlacklist(L"overflow.dll")); 110 EXPECT_FALSE(blacklist::AddDllToBlacklist(L"overflow.dll"));
111 for (int i = 0; i < empty_spaces; ++i) { 111 for (int i = 0; i < empty_spaces; ++i) {
112 EXPECT_TRUE(blacklist::RemoveDllFromBlacklist(added_dlls[i].c_str())) << i; 112 EXPECT_TRUE(blacklist::RemoveDllFromBlacklist(added_dlls[i].c_str())) << i;
113 } 113 }
114 EXPECT_FALSE(blacklist::RemoveDllFromBlacklist(added_dlls[0].c_str())); 114 EXPECT_FALSE(blacklist::RemoveDllFromBlacklist(added_dlls[0].c_str()));
115 EXPECT_FALSE(blacklist::RemoveDllFromBlacklist( 115 EXPECT_FALSE(blacklist::RemoveDllFromBlacklist(
116 added_dlls[empty_spaces - 1].c_str())); 116 added_dlls[empty_spaces - 1].c_str()));
117 } 117 }
118 118
119 TEST_F(BlacklistTest, LoadBlacklistedLibrary) { 119 TEST_F(BlacklistTest, LoadBlacklistedLibrary) {
120 // TODO(robertshield): Add 64-bit support.
121 #if !defined(_WIN64)
122 base::FilePath current_dir; 120 base::FilePath current_dir;
123 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &current_dir)); 121 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &current_dir));
124 122
125 // Test that an un-blacklisted DLL can load correctly. 123 // Test that an un-blacklisted DLL can load correctly.
126 base::ScopedNativeLibrary dll1(current_dir.Append(kTestDllName1)); 124 base::ScopedNativeLibrary dll1(current_dir.Append(kTestDllName1));
127 EXPECT_TRUE(dll1.is_valid()); 125 EXPECT_TRUE(dll1.is_valid());
128 dll1.Reset(NULL); 126 dll1.Reset(NULL);
129 127
130 struct TestData { 128 struct TestData {
131 const wchar_t* dll_name; 129 const wchar_t* dll_name;
(...skipping 28 matching lines...) Expand all
160 base::string16 uppercase_name = base::i18n::ToUpper(test_data[i].dll_name); 158 base::string16 uppercase_name = base::i18n::ToUpper(test_data[i].dll_name);
161 EXPECT_TRUE(TestDll_AddDllToBlacklist(uppercase_name.c_str())); 159 EXPECT_TRUE(TestDll_AddDllToBlacklist(uppercase_name.c_str()));
162 base::ScopedNativeLibrary dll_blacklisted_different_case( 160 base::ScopedNativeLibrary dll_blacklisted_different_case(
163 current_dir.Append(test_data[i].dll_name)); 161 current_dir.Append(test_data[i].dll_name));
164 EXPECT_FALSE(dll_blacklisted_different_case.is_valid()); 162 EXPECT_FALSE(dll_blacklisted_different_case.is_valid());
165 EXPECT_EQ(0u, ::GetEnvironmentVariable(test_data[i].dll_beacon, NULL, 0)); 163 EXPECT_EQ(0u, ::GetEnvironmentVariable(test_data[i].dll_beacon, NULL, 0));
166 dll_blacklisted_different_case.Reset(NULL); 164 dll_blacklisted_different_case.Reset(NULL);
167 165
168 EXPECT_TRUE(TestDll_RemoveDllFromBlacklist(uppercase_name.c_str())); 166 EXPECT_TRUE(TestDll_RemoveDllFromBlacklist(uppercase_name.c_str()));
169 } 167 }
170 #endif
171 } 168 }
OLDNEW
« no previous file with comments | « chrome_elf/blacklist/blacklist_interceptions.cc ('k') | sandbox/win/src/service_resolver_64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698