summaryrefslogtreecommitdiffstats
path: root/base/file_path_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Header cleanup in base.brettw@chromium.org2010-08-171-3/+3
| | | | | | | | | | | | | | This makes uses of StringPrintf and friends use the base namespace and include stringprintf.h explicitly. This also removes a bunch of unnecessary string_util includes (which exposed a few other errors like people forgetting to include <vector>. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3119022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56446 0039d316-1c4b-4281-b951-d872f2087c98
* Treat multiple extensions like .tar.gz as a single extension.estade@chromium.org2010-07-271-4/+43
| | | | | | | | | | | The logic is taken from firefox. BUG=48346 TEST=unit tests; downloading the same .tar.gz file multiple times (see bug) Review URL: http://codereview.chromium.org/3018011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53844 0039d316-1c4b-4281-b951-d872f2087c98
* Add a method for normalizing path separators on Windows.tony@chromium.org2010-06-251-1/+45
| | | | | | | | TEST=new unittests Review URL: http://codereview.chromium.org/2831029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50822 0039d316-1c4b-4281-b951-d872f2087c98
* Get rid of FilePath::AppendAndResolveRelative().mad@chromium.org2009-10-281-92/+0
| | | | | | | | | | | | | | To resolve the problem of '..' parent references as well as symbolic links on POSIX platforms, we can simply use the file_util::AbsolutePath() function. This has the drawback of having a different behavior on Windows and POSIX platforms, in the way that it can return a canonical path that doesn't exists when ran on Windows, but it will return an empty path (or false) when run on a POSIX platform. So we need to add an extra PathExists() call to unify the behavior. BUG=25681,25131 Review URL: http://codereview.chromium.org/343003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30334 0039d316-1c4b-4281-b951-d872f2087c98
* Fix for bug 10876 that resulted in some refactoring:rolandsteiner@chromium.org2009-10-281-14/+110
| | | | | | | | | | | | | | | | | | | | | The bug originates from extensions being treated case sensitive on Windows and Mac OSX, where they shouldn't be. Therefore I added generic static methods to FilePath to compare strings in the same way the file system does, and changed the relevant parts of the code to make use of them. I tested the methods under Windows and Mac OS X. I also wrote a basic version for Linux/Posix that behaves the same way as the original code, so there should at least be no regression. Also, while fixing this I found some confusion in the code about whether extensions are used with or without leading dot. For this reason I changed some functions that were taking an extension as parameter to instead take the whole file path. This makes calling these functions easier and the caller doesn't need to know whether the extension is supposed to be with or without dot. In the same vein, I split DownloadManager::IsExecutable into IsExecutableFile, where one again passes in the whole file and doesn't have to worry about getting the extension right, and IsExecutableExtension, which corresponds to the original functionality. Ideally only the former method should be public, but that again would have required further code scrubbing that was (even more) outside of the original bug fix. Finally, fixed a wrong comment in the file path tests. BUG=10876 TEST=FilePathTest.MatchesExtension, .CompareIgnoreCase Review URL: http://codereview.chromium.org/149796 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30323 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 30168 - Commit patch set from http://codereview.chromium.org/149796rolandsteiner@chromium.org2009-10-271-111/+14
| | | | | | | | | | | | | (see discussion and history there) BUG=10876 TEST=FilePathTest.MatchesExtension.CompareIgnoreCase TBR=rolandsteiner@chromium.org Review URL: http://codereview.chromium.org/337042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30170 0039d316-1c4b-4281-b951-d872f2087c98
* Commit patch set from http://codereview.chromium.org/149796rolandsteiner@chromium.org2009-10-271-14/+111
| | | | | | | | | | (see discussion and history there) BUG=10876 TEST=FilePathTest.MatchesExtension.CompareIgnoreCase git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30168 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 30149 - The existing file_util::AbsolutePath() function was already ↵tim@chromium.org2009-10-271-0/+92
| | | | | | | | | | | | | doing what we needed to do in the ExtensionResource class. BUG= http://crbug.com/25681 & http://crbug.com/25131 Review URL: http://codereview.chromium.org/334028 TBR=mad@chromium.org Review URL: http://codereview.chromium.org/335042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30152 0039d316-1c4b-4281-b951-d872f2087c98
* The existing file_util::AbsolutePath() function was already doing what we ↵mad@chromium.org2009-10-271-92/+0
| | | | | | | | | | needed to do in the ExtensionResource class. BUG= http://crbug.com/25681 & http://crbug.com/25131 Review URL: http://codereview.chromium.org/334028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30149 0039d316-1c4b-4281-b951-d872f2087c98
* Minimize dependency of user scripts.mad@chromium.org2009-10-201-2/+94
| | | | | | | | | | | And made some minor lint fixes and code refactoring on the way, based on CR comments of previous attempt. BUG=none TEST=Make sure that the extension resources can still be properly localized and that they also load correctly when they are not localized. Review URL: http://codereview.chromium.org/267051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29512 0039d316-1c4b-4281-b951-d872f2087c98
* Add FilePathTest.StripTrailingSeparators to base_unittests to testmark@chromium.org2009-10-131-1/+64
| | | | | | | | | | FilePath::StripTrailingSeparators. BUG=24692 TEST=this Review URL: http://codereview.chromium.org/272039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28832 0039d316-1c4b-4281-b951-d872f2087c98
* Fix and reenable AppendRelativePathTest which was broken on Windows.mark@chromium.org2009-09-231-3/+13
| | | | | | | | | Patch by Fred Akalin <akalin@gmail.com> Review URL: http://codereview.chromium.org/205023 Review URL: http://codereview.chromium.org/209070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26968 0039d316-1c4b-4281-b951-d872f2087c98
* Disable FilePathTest.AppendRelativeTest from r26387.mark@chromium.org2009-09-161-1/+1
| | | | | | Review URL: http://codereview.chromium.org/194132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26390 0039d316-1c4b-4281-b951-d872f2087c98
* Set OS X cache directory to ~/Library/Caches/[app name]/[profile name] mark@chromium.org2009-09-161-0/+70
| | | | | | | | | | | | | - Added implementation of GetUserCacheDirectory() for OS X. - Added FilePath::GetRelativePath(). - Implemented per-profile cache directories for OS X. Patch by Fred Akalin <akalin@gmail.com> Code review URL: http://codereview.chromium.org/174053 Review URL: http://codereview.chromium.org/204043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26387 0039d316-1c4b-4281-b951-d872f2087c98
* Add "bool FilePath::ReferencesParent()" which adds a clean & simple way forcevans@chromium.org2009-08-151-1/+32
| | | | | | | | | | | | checking for ".." in a FilePath. Needed to make an upcoming security fix clean. BUG=NONE TEST=FilePathTest.ReferencesParent Review URL: http://codereview.chromium.org/172012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23528 0039d316-1c4b-4281-b951-d872f2087c98
* make FilePath:IsParent use case-insensitive compare for drive letters on windowsrafaelw@chromium.org2009-07-011-1/+70
| | | | | | | | | R=erikkay BUG=15659 Review URL: http://codereview.chromium.org/150109 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19694 0039d316-1c4b-4281-b951-d872f2087c98
* Allow extension extensions to be case-insensitive.avi@chromium.org2009-06-291-26/+57
| | | | | | | | | BUG=none TEST=try to load an extension with a capital letter or two in the extension's extension. It should load. Review URL: http://codereview.chromium.org/147017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19520 0039d316-1c4b-4281-b951-d872f2087c98
* Move PathComponents from file_util to FilePath, add FilePath::IsParent()rafaelw@chromium.org2009-06-241-0/+102
| | | | | | | | r=erikkay,mark Review URL: http://codereview.chromium.org/145026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19174 0039d316-1c4b-4281-b951-d872f2087c98
* Adds AppendASCII which will append an ASCII path component.erikkay@google.com2009-01-211-1/+12
| | | | | | | | Since this is safe to do on all platform path encodings (even Linux), this allows path components to be taken from ASCII sources without #ifdefs for the caller. Review URL: http://codereview.chromium.org/18134 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8394 0039d316-1c4b-4281-b951-d872f2087c98
* Move Contains() method to file_utils, stop relying on in extensions_protocolaa@chromium.org2009-01-091-44/+0
| | | | | | Review URL: http://codereview.chromium.org/16805 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7841 0039d316-1c4b-4281-b951-d872f2087c98
* Add implementations of various extension related methods (derived from ↵erikkay@google.com2009-01-091-0/+159
| | | | | | | | | | | | file_util): Extension, RemoveExtension, InsertBeforeExtension, ReplaceExtension I didn't reimplement the old file_util ones since they actually modify the FilePath in place, which isn't the style of the rest of the FilePath methods. I'll file a cleanup bug after this for callers to switch to the new methods. Review URL: http://codereview.chromium.org/17243 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7811 0039d316-1c4b-4281-b951-d872f2087c98
* Keep trying to undo 7564.estade@chromium.org2009-01-051-2/+2
| | | | | | | | tbr=jhawkins Review URL: http://codereview.chromium.org/17062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7572 0039d316-1c4b-4281-b951-d872f2087c98
* Unbreak unit tests. Revert r7564.estade@chromium.org2009-01-051-2/+2
| | | | | | | | tbr=jhawkins Review URL: http://codereview.chromium.org/16522 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7571 0039d316-1c4b-4281-b951-d872f2087c98
* fix merge failureaa@chromium.org2008-12-181-1/+0
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7209 0039d316-1c4b-4281-b951-d872f2087c98
* Rather than create a TODO that will never be done, I went ahead and ↵aa@chromium.org2008-12-181-6/+64
| | | | | | | | implemented FilePath::Contains(). Review URL: http://codereview.chromium.org/14827 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7208 0039d316-1c4b-4281-b951-d872f2087c98
* Make FilePath::Append accept FilePath parameter. Patch by Paweł Hajdan jrmark@chromium.org2008-12-081-2/+5
| | | | | | | | | <phajdan.jr@gmail.com> http://codereview.chromium.org/12907 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6511 0039d316-1c4b-4281-b951-d872f2087c98
* Backing out r6315 due to DirectoryWatcherTest.SubDir (base_unittests) failuremark@chromium.org2008-12-031-5/+2
| | | | | | | (again) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6316 0039d316-1c4b-4281-b951-d872f2087c98
* Make FilePath::Append accept FilePath parameter. Patch by Paweł Hajdan jrmark@chromium.org2008-12-031-2/+5
| | | | | | | | | <phajdan.jr@gmail.com> http://codereview.chromium.org/12907 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6315 0039d316-1c4b-4281-b951-d872f2087c98
* Backing out r6299 due to DirectoryWatcherTest.SubDir (base_unittests) failuremark@chromium.org2008-12-031-5/+2
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6304 0039d316-1c4b-4281-b951-d872f2087c98
* Make FilePath::Append accept FilePath parameter. Patch by Paweł Hajdan jrmark@chromium.org2008-12-031-2/+5
| | | | | | | | | <phajdan.jr@gmail.com> http://codereview.chromium.org/12907 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6299 0039d316-1c4b-4281-b951-d872f2087c98
* Use the full src-relative path to gtest.hmark@chromium.org2008-10-031-1/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2841 0039d316-1c4b-4281-b951-d872f2087c98
* Add a FilePath objectmark@chromium.org2008-10-031-0/+348
Review URL: http://codereview.chromium.org/6025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2838 0039d316-1c4b-4281-b951-d872f2087c98