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

Side by Side Diff: base/file_util_unittest.cc

Issue 9585001: Cleanup: Remove deprecated version of file_util::AppendToPath(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « base/file_util_deprecated.h ('k') | base/test/test_file_util_win.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 {L"/foo/bar", L"path", L"/foo/bar/path"}, 227 {L"/foo/bar", L"path", L"/foo/bar/path"},
228 {L"/foo/bar/", L"path", L"/foo/bar/path"}, 228 {L"/foo/bar/", L"path", L"/foo/bar/path"},
229 {L"/foo/bar//", L"path", L"/foo/bar//path"}, 229 {L"/foo/bar//", L"path", L"/foo/bar//path"},
230 {L"/foo/bar/", L"", L"/foo/bar/"}, 230 {L"/foo/bar/", L"", L"/foo/bar/"},
231 {L"/foo/bar", L"", L"/foo/bar/"}, 231 {L"/foo/bar", L"", L"/foo/bar/"},
232 {L"", L"path", L"/path"}, 232 {L"", L"path", L"/path"},
233 {L"", L"", L"/"}, 233 {L"", L"", L"/"},
234 #endif 234 #endif
235 }; 235 };
236 236
237 #if defined(OS_WIN)
238 // This function is deprecated, but still used on Windows.
239 TEST_F(FileUtilTest, AppendToPath) {
240 for (unsigned int i = 0; i < arraysize(append_cases); ++i) {
241 const append_case& value = append_cases[i];
242 std::wstring result = value.path;
243 file_util::AppendToPath(&result, value.ending);
244 EXPECT_EQ(value.result, result);
245 }
246
247 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
248 file_util::AppendToPath(NULL, L"path"); // asserts in debug mode
249 #endif
250 }
251 #endif // defined(OS_WIN)
252
253 static const struct filename_case { 237 static const struct filename_case {
254 const wchar_t* path; 238 const wchar_t* path;
255 const wchar_t* filename; 239 const wchar_t* filename;
256 } filename_cases[] = { 240 } filename_cases[] = {
257 #if defined(OS_WIN) 241 #if defined(OS_WIN)
258 {L"c:\\colon\\backslash", L"backslash"}, 242 {L"c:\\colon\\backslash", L"backslash"},
259 {L"c:\\colon\\backslash\\", L""}, 243 {L"c:\\colon\\backslash\\", L""},
260 {L"\\\\filename.exe", L"filename.exe"}, 244 {L"\\\\filename.exe", L"filename.exe"},
261 {L"filename.exe", L"filename.exe"}, 245 {L"filename.exe", L"filename.exe"},
262 {L"", L""}, 246 {L"", L""},
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 file_util::VerifyPathControlledByUser( 2247 file_util::VerifyPathControlledByUser(
2264 base_dir_, text_file_, uid_, ok_gids_)); 2248 base_dir_, text_file_, uid_, ok_gids_));
2265 EXPECT_TRUE( 2249 EXPECT_TRUE(
2266 file_util::VerifyPathControlledByUser( 2250 file_util::VerifyPathControlledByUser(
2267 sub_dir_, text_file_, uid_, ok_gids_)); 2251 sub_dir_, text_file_, uid_, ok_gids_));
2268 } 2252 }
2269 2253
2270 #endif // defined(OS_POSIX) 2254 #endif // defined(OS_POSIX)
2271 2255
2272 } // namespace 2256 } // namespace
OLDNEW
« no previous file with comments | « base/file_util_deprecated.h ('k') | base/test/test_file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698