summaryrefslogtreecommitdiffstats
path: root/base/file_util_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Reland "Remove base/scoped_handle_win.h."tfarina@chromium.org2011-01-091-5/+8
| | | | | | | | | | | | | | | Fixed the problem with rlz library. Now should be fine to land this again. This reverts commit 3620d9501af7bff688862c54fdd60f7eb41797f3. Original Review URL: http://codereview.chromium.org/6126002/ BUG=None TEST=trybots Review URL: http://codereview.chromium.org/6110005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70861 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Remove base/scoped_handle_win.h stub and fix up all callers to use ↵thakis@chromium.org2011-01-071-8/+5
| | | | | | | | | | the new location and namespace." This reverts r 70795, it broke the build. TBR=vandebo git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70802 0039d316-1c4b-4281-b951-d872f2087c98
* Remove base/scoped_handle_win.h stub and fix up all callers to use the new ↵tfarina@chromium.org2011-01-071-5/+8
| | | | | | | | | | | location and namespace. BUG=None TEST=trybots Review URL: http://codereview.chromium.org/6126002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70795 0039d316-1c4b-4281-b951-d872f2087c98
* Use FilePath::DirName instead of the deprecated file_util::GetDirectoryFromPath.tfarina@chromium.org2011-01-071-12/+0
| | | | | | | | | | | Fix the callers and remove the deprecated function. BUG=24672 TEST=trybots Review URL: http://codereview.chromium.org/6111003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70705 0039d316-1c4b-4281-b951-d872f2087c98
* base: Remove deprecated file_util::GetFilenameFromPath function.tfarina@chromium.org2011-01-061-11/+0
| | | | | | | | | BUG=24672 TEST=trybots Review URL: http://codereview.chromium.org/6057010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70610 0039d316-1c4b-4281-b951-d872f2087c98
* Move platform_thread to base/threading and put in the base namespace. I left abrettw@chromium.org2010-12-311-3/+3
| | | | | | | | | | | stub and "using" declarations in the old location to avoid having to change the entire project at once. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/6001010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70342 0039d316-1c4b-4281-b951-d872f2087c98
* Some additions to support symlinks better on platforms that support them.gspencer@chromium.org2010-11-301-11/+40
| | | | | | | | | BUG=none TEST=Ran new unit test, passed trybots. Review URL: http://codereview.chromium.org/5349007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67631 0039d316-1c4b-4281-b951-d872f2087c98
* Add a TouchFile() function that takes a FilePath argument.dumi@chromium.org2010-09-231-3/+13
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/3496005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60381 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Add a TouchFile function that operates on FilePaths + fixing a bug"maruel@chromium.org2010-09-231-13/+3
| | | | | | | | | | | | This reverts commit 60322. TBR=dumi TEST=none BUG=none Review URL: http://codereview.chromium.org/3439019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60327 0039d316-1c4b-4281-b951-d872f2087c98
* Add a TouchFile function that operates on FilePaths + fixing a bugdumi@chromium.org2010-09-231-3/+13
| | | | | | | | | | | related to FILE_WRITE_ATTRIBUTES on Windows. BUG=none TEST=FileUtilTest::TouchFile Review URL: http://codereview.chromium.org/3404018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60322 0039d316-1c4b-4281-b951-d872f2087c98
* GTTF: Fix FileUtilTest so multiple test instances can run in parallel.phajdan.jr@chromium.org2010-09-151-110/+106
| | | | | | | | | BUG=54098 TEST=base_unittests Review URL: http://codereview.chromium.org/3444003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59548 0039d316-1c4b-4281-b951-d872f2087c98
* Moving file_util::FileInfo to base::PlatformFileInfo, and adding thedumi@chromium.org2010-09-031-1/+1
| | | | | | | | | | | | last_accessed and creation_time fields. BUG=none TEST=none Review URL: http://codereview.chromium.org/3347005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58454 0039d316-1c4b-4281-b951-d872f2087c98
* FBTF: Remove unneeded headers from base/ (part 7)thestig@chromium.org2010-08-271-1/+0
| | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/3176026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57737 0039d316-1c4b-4281-b951-d872f2087c98
* Spelling correction: "nonexistant" -> "nonexistent".viettrungluu@chromium.org2010-08-221-1/+1
| | | | | | | | | BUG=none TEST=good spellers are slightly happier Review URL: http://codereview.chromium.org/3143037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57020 0039d316-1c4b-4281-b951-d872f2087c98
* Get rid of the deprecated file_util::InsertBeforeExtension.tfarina@chromium.org2010-08-181-63/+0
| | | | | | | | | BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3161018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56477 0039d316-1c4b-4281-b951-d872f2087c98
* Fix incorect tests against INVALID_FILE_HANDLE, as pointed out by cpu on ↵skerner@chromium.org2010-08-031-3/+3
| | | | | | | | | | | chrome-team. BUG=NONE TEST=FileUtilTest.NormalizeFilePath* Review URL: http://codereview.chromium.org/3031041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54701 0039d316-1c4b-4281-b951-d872f2087c98
* Remove some debug switches:skerner@chromium.org2010-07-301-1/+0
| | | | | | | | | | | | | | --issue35198-crxdir-browser --issue35198-permission They were used to understand issue 35198. They are no longer needed. There is one more switch, --issue35198-logging, that is not being removed in this CL. The logging it adds may still be useful. BUG=50604 TEST=manual Review URL: http://codereview.chromium.org/3052023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54323 0039d316-1c4b-4281-b951-d872f2087c98
* Remove <iostream> where possible.erg@google.com2010-07-201-1/+0
| | | | | | | | | | | | | <iostream> creates a static initializer. Most people don't need <iostream> anyway--they really need <ostream> for operator<< overloads. <iostream> should *never* be included in a header file; <iosfwd> exists for that purpose. BUG=none TEST=none Review URL: http://codereview.chromium.org/3014015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53083 0039d316-1c4b-4281-b951-d872f2087c98
* Deprecate most of the remaining wstring file_util functions.evan@chromium.org2010-07-081-0/+6
| | | | | | | | | | | | | These still exist on Windows due to being used by the installer, but by moving them into the Windows-only block we prevent them from being used in new code. (I am already finding new code using some of these! I am glad to be rid of them.) BUG=24672 Review URL: http://codereview.chromium.org/2850042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51862 0039d316-1c4b-4281-b951-d872f2087c98
* Deprecate more old filepath functions.evan@chromium.org2010-07-011-0/+3
| | | | | | | | | | | | These still exist on Windows due to being used by the installer, but by moving them into the Windows-only block we prevent them from being used in new code. BUG=24672 Review URL: http://codereview.chromium.org/2861042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51453 0039d316-1c4b-4281-b951-d872f2087c98
* Loosen permission on extension temp dir when a flag is used.skerner@chromium.org2010-07-011-0/+1
| | | | | | | | | | | | | | | | | | | Issue 35198 can not be reproduced locally. To enable users to do experiments, three command line flags are added to chrome: --issue35198-crxdir-browser: Have the browser process create the directory in which the extension will be unzipped. --issue35198-logging: Enable log messages from directory creation in the utility process to be moved to the browser process. --issue35198-permission: Use the most permissive file permissions possible on the extension unpack directory. BUG=35198 TEST=manual Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=51231 Review URL: http://codereview.chromium.org/2802018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51416 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 51231 - Loosen permission on extension temp dir when a flag is used.skerner@chromium.org2010-06-301-2/+1
| | | | | | | | | | | | | | | | | | | | Issue 35198 can not be reproduced locally. To enable users to do experiments, three command line flags are added to chrome: --issue35198-crxdir-browser: Have the browser process create the directory in which the extension will be unzipped. --issue35198-logging: Enable log messages from directory creation in the utility process to be moved to the browser process. --issue35198-permission: Use the most permissive file permissions possible on the extension unpack directory. BUG=35198 TEST=manual Review URL: http://codereview.chromium.org/2802018 TBR=skerner@chromium.org Review URL: http://codereview.chromium.org/2861039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51238 0039d316-1c4b-4281-b951-d872f2087c98
* Loosen permission on extension temp dir when a flag is used.skerner@chromium.org2010-06-301-1/+2
| | | | | | | | | | | | | | | | | Issue 35198 can not be reproduced locally. To enable users to do experiments, three command line flags are added to chrome: --issue35198-crxdir-browser: Have the browser process create the directory in which the extension will be unzipped. --issue35198-logging: Enable log messages from directory creation in the utility process to be moved to the browser process. --issue35198-permission: Use the most permissive file permissions possible on the extension unpack directory. BUG=35198 TEST=manual Review URL: http://codereview.chromium.org/2802018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51231 0039d316-1c4b-4281-b951-d872f2087c98
* Add histograms to track the size of the profile data.rvargas@google.com2010-06-111-0/+6
| | | | | | | | | | BUG=16705 TEST=FileUtilTest.FileAndDirectorySize Review URL: http://codereview.chromium.org/2778006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49606 0039d316-1c4b-4281-b951-d872f2087c98
* Minor comment fix.glider@chromium.org2010-06-101-0/+1
| | | | | | | | | TBR=phajdan.jr BUG=46246 Review URL: http://codereview.chromium.org/2735009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49389 0039d316-1c4b-4281-b951-d872f2087c98
* Mark FileUtilTest.CountFilesCreatedAfter as flakyglider@chromium.org2010-06-101-2/+2
| | | | | | | | | TBR=erikkay BUG=46246 Review URL: http://codereview.chromium.org/2756007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49386 0039d316-1c4b-4281-b951-d872f2087c98
* Give the extension unpacker process a junction/symlink free path to the ↵skerner@chromium.org2010-06-091-28/+281
| | | | | | | | | | | unpack directory. BUG=35198,13044 TEST=FileUtilTest.NormalizeFilePathBasic,FileUtilTest. NormalizeFilePathReparsePoints,FileUtilTest.NormalizeFilePathSymlinks Review URL: http://codereview.chromium.org/2088006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49337 0039d316-1c4b-4281-b951-d872f2087c98
* Remove deprecated file_util::ReplaceExtension API.tfarina@chromium.org2010-06-011-44/+0
| | | | | | | | | BUG=24672 TEST=out/Debug/base_unittests Review URL: http://codereview.chromium.org/2445001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48614 0039d316-1c4b-4281-b951-d872f2087c98
* file_util: Convert the wstring version of IsDirectoryEmpty to FilePath.tfarina@chromium.org2010-05-261-0/+16
| | | | | | | | | BUG=24672 TEST=compiles Review URL: http://codereview.chromium.org/2153002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48237 0039d316-1c4b-4281-b951-d872f2087c98
* Use realpath() to find the path to the extension unpack dir on posix systems.skerner@chromium.org2010-05-121-0/+51
| | | | | | | | | | | | | Extensions are unpacked by a sandboxed utility process. The sandbox forbids file access outside the directory the extension will be unpacked in. If the path to that directory contains a symbolic link, then unpacking will fail because following the link will cause file system access outside the sandbox path. Use realpath() to get a symlink free path to the directory where the extension will be unpacked. A similar issue exists on windows, with junctions instead of symlinks. This will be fixed in another change. BUG=13044,35198 TEST=FileUtilTest.RealPath Review URL: http://codereview.chromium.org/2001013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47032 0039d316-1c4b-4281-b951-d872f2087c98
* Windows: Make file_util::Delete("c:\\foo_dir", false) work correctly. Add ↵thestig@chromium.org2010-05-071-13/+125
| | | | | | | | | | more unit tests for Delete. BUG=42374 TEST=included Review URL: http://codereview.chromium.org/1763008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46725 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 46633 - Windows: Make file_util::Delete("c:\\foo_dir", false) work ↵zork@chromium.org2010-05-071-125/+13
| | | | | | | | | | | | | correctly. Add more unit tests for Delete. BUG=42374 TEST=included Review URL: http://codereview.chromium.org/1763008 TBR=thestig@chromium.org Review URL: http://codereview.chromium.org/2038004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46640 0039d316-1c4b-4281-b951-d872f2087c98
* Windows: Make file_util::Delete("c:\\foo_dir", false) work correctly. Add ↵thestig@chromium.org2010-05-061-13/+125
| | | | | | | | | | more unit tests for Delete. BUG=42374 TEST=included Review URL: http://codereview.chromium.org/1763008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46633 0039d316-1c4b-4281-b951-d872f2087c98
* Unpack extensions inside chrome's profile directory.skerner@chromium.org2010-04-301-0/+11
| | | | | | | | | | | Other users of the temp directory will be altered in a subsequent CL. BUG=13044 TEST=SandboxedExtensionUnpackerTest.*, ScopedTempDir.UniqueTempDirUnderPath, FileUtilTest.CreateNewTempDirInDirTest, manual testing on win, linux, mac. Review URL: http://codereview.chromium.org/1582022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46078 0039d316-1c4b-4281-b951-d872f2087c98
* Function to compute the total size of the files in a directorycpu@chromium.org2010-03-241-0/+28
| | | | | | | | | | | | | We need this for the diagnostic mode but it can be used by others. Did not see test for GetFileSize() so added them BUG=none TEST=ut included Review URL: http://codereview.chromium.org/1220001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42540 0039d316-1c4b-4281-b951-d872f2087c98
* Deprecate file_util::AppendToPath() on non-Windows.evan@chromium.org2010-02-261-0/+4
| | | | | | | | | | | | We still have ~150 callers to AppendToPath in our code, but most of them are in the installer and I'm reluctant to fiddle with that code without having an easy way to test it. BUG=24672 Review URL: http://codereview.chromium.org/654013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40120 0039d316-1c4b-4281-b951-d872f2087c98
* Deprecate GetDirectoryFromPath on non-Windows.evan@chromium.org2010-02-231-0/+3
| | | | | | | | | | | Due to a bunch of changes I made last week, we now only need this in Windows-specific codepaths. BUG=24672 Review URL: http://codereview.chromium.org/654009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39715 0039d316-1c4b-4281-b951-d872f2087c98
* Actually delete databases in CookiesTreeModel.jochen@chromium.org2010-02-181-1/+25
| | | | | | | | | BUG=34633 TEST=delete a database while it's opened in the renderer Review URL: http://codereview.chromium.org/600104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39346 0039d316-1c4b-4281-b951-d872f2087c98
* Changes to base/ from a combination of FreeBSD and OpenBSD patches.evan@chromium.org2009-12-291-5/+5
| | | | | | Review URL: http://codereview.chromium.org/495002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35321 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a regression introduced by r33225.huanr@chromium.org2009-12-171-0/+9
| | | | | | | | | | | | On windows, if CreateDirectory is called with an path on an inaccessible drive, it will enter an infinite loop. BUG=30415 TEST=base_unittests.exe --gtest_filter=FileUtilTest.CreateDirectoryTest Review URL: http://codereview.chromium.org/500075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34871 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the deprecated version of ContentsEqual.thakis@chromium.org2009-12-011-1/+3
| | | | | | | | | | BUG=24672 TEST=base_unittests Review URL: http://codereview.chromium.org/432001 Patch from tfarina. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33483 0039d316-1c4b-4281-b951-d872f2087c98
* Fix race in directory creation on Windows. Thejoi@chromium.org2009-11-271-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | file_util::CreateDirectory() function is supposed to succeed if the directory already exists, but in the previous implementation when two processes/threads called the function at the same time for the same path, one would see a failure. Also, get rid of the use of SHCreateDirectoryEx function. For one, it is highly serializing because it calls SHChangeNotify. The race was actually easy to reproduce by starting two instances of Chrome both at the same time, with a profile directory flag indicating a profile directory that did not previously exist. For another, SHCreateDirectoryEx would fail with ERROR_CANCELLED if any of the path components were not visible, according to its MSDN documentation. BUG=none TEST=[base_unittests.exe --gtest_filter=*CreateDirectory* ], and/or install Chrome Frame on a fresh machine and make sure the first page you navigate to has two Chrome Frame instances on it - you should get no DCHECK on failure of PathService::Override Review URL: http://codereview.chromium.org/437090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33225 0039d316-1c4b-4281-b951-d872f2087c98
* Set prop app id for chromium/application shortcut.xiyuan@chromium.org2009-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow up change after andrew's patch for win7 shortcut to properly set app id for chromium/application shortcut. - Move PKEY_AppUserModel_ID and code to set it from app/win_util.cc to base/win_util.cc as SetAppIdForPropertyStore to share with file_util shortcut code; - Add an app_id args to file_util's CreateShortcutLink and UpdateShortcutLink; - Update code that calls the above two function in installer and UserDataManager so that the chromium shortcuts are created with proper app id (except the uninstall shortcut which is not tagged with any app id). - Move ComputeApplicationNameFromURL from Browser to web_app namespace and use it as app id for application shortcut. This makes pinned shortcut and browser window use the same app id and Win7 correctly groups them; - Rename ComputeApplicationNameFromURL to GenerateApplicationNameFromURL per Ben's comments; - Add a DCHECK in SetAppIdForPropertyStore to ensure app id is less than 128 chars and contains no space per msdn; - Change default app id from IDS_PRODUCT_NAME to chrome::kBrowserAppName BUG=28104 TEST=On Win7, pinned shortcut should no longer be separated from running instance of chrome for both chrome and web application. Review URL: http://codereview.chromium.org/399045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32508 0039d316-1c4b-4281-b951-d872f2087c98
* Remove file_util::TrimTrailingSeparators(), which is deprecated andtkent@chromium.org2009-10-151-1/+1
| | | | | | | | | | doesn't work well for Windows root drives. BUG=24722 TEST=existing tests are enough. Review URL: http://codereview.chromium.org/271086 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29093 0039d316-1c4b-4281-b951-d872f2087c98
* More CopyDirectory tests and fixesvandebo@chromium.org2009-10-151-0/+116
| | | | | | | | | BUG=themes stopped working on Linux and Mac TEST=unittests Review URL: http://codereview.chromium.org/269083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29076 0039d316-1c4b-4281-b951-d872f2087c98
* Match window's behavior when recursively copying directories that exist.vandebo@chromium.org2009-10-131-3/+142
| | | | | | | | | | | Unit test improvement from here (sgk): http://codereview.chromium.org/271060 BUG=none TEST=unittests Review URL: http://codereview.chromium.org/270086 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28838 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes a bug that .crx can not be installed by "Could not createtkent@chromium.org2009-10-091-1/+30
| | | | | | | | | | | directory for unzipping." in the case that the environment variable TMP is set to a root directory of a drive such as "C:\" TEST=Add new tests to base_unittest BUG=23911 Review URL: http://codereview.chromium.org/257061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28529 0039d316-1c4b-4281-b951-d872f2087c98
* Separate out some more ICU from base and into base/i18n.brettw@chromium.org2009-10-081-88/+1
| | | | | | | | | | | | | | | | | | | | This moves string_util_icu. I moved the number formatting function into base/i18n/number_formatting and just removed the other function in string_util_icu which was TrimWhitespaceUTF8. It is only used in a few places and isn't actually helpful (and the fact that it round-trips through UTF-16 is better for the caller to see). This takes out the sorting from the FileEnumerator. The comment says the sorting is not guaranteed. I moved it into file_util_icu as a standalone function for callers of FileEnumerator to call manually if they need sorted results. I modified the directory lister to use this sorting instead, and filed a bug on doing more optimal JS-based sorting. TEST=none BUG=none Review URL: http://codereview.chromium.org/267001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28405 0039d316-1c4b-4281-b951-d872f2087c98
* Copy the relevant parts of ICU to a new file base/third_party/icu/icu_utf.*brettw@chromium.org2009-10-071-1/+1
| | | | | | | | | | | | | | so we can do basic UTF8/16/32 conversions without linking all of ICU. Change callers who used to call SysUTF8ToWide/SysWideToUTF8 in base to using these new functions. I will remove the Sys versions of these functions in a later patch. TEST=none BUG=none Review URL: http://codereview.chromium.org/243102 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28219 0039d316-1c4b-4281-b951-d872f2087c98
* Avoids the use of ToWStringHack in a few places.evan@chromium.org2009-08-261-15/+15
| | | | | | | | | | BUG=None TEST=run app_unittests.exe, browser_tests.exe and selenium_tests.exe Review URL: http://codereview.chromium.org/173418 Patch from Thiago Farina <thiago.farina@gmail.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24504 0039d316-1c4b-4281-b951-d872f2087c98