diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 02:49:05 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 02:49:05 +0000 |
commit | b4113d5feb3b47f5f9aaa4e7aeeacc0d95d81f36 (patch) | |
tree | e455862522cfe5a297c70edbce743e021a5769af /base/mac_util_unittest.mm | |
parent | 1c966c891f7f495fd08c84b58ec145bd6bd7d181 (diff) | |
download | chromium_src-b4113d5feb3b47f5f9aaa4e7aeeacc0d95d81f36.zip chromium_src-b4113d5feb3b47f5f9aaa4e7aeeacc0d95d81f36.tar.gz chromium_src-b4113d5feb3b47f5f9aaa4e7aeeacc0d95d81f36.tar.bz2 |
For the immediate milestone, exclude History and Thumbnails from being backed up by Time Machine. The bug describes appropriate long-term solutions to this problem.
BUG=259595
TEST=Launch Chrome. Inspect the following files found in ~/Library/Application Support/Chromium/Default/: a) History, b) History-journal, c) Thumbnails, and d) Thumbnails-journal and verify that they are not being backed up by Time Machine.
Review URL: http://codereview.chromium.org/387016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31644 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac_util_unittest.mm')
-rw-r--r-- | base/mac_util_unittest.mm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/base/mac_util_unittest.mm b/base/mac_util_unittest.mm index 0abdee7..5e97356 100644 --- a/base/mac_util_unittest.mm +++ b/base/mac_util_unittest.mm @@ -8,6 +8,7 @@ #include "base/mac_util.h" #include "base/file_path.h" +#include "base/file_util.h" #include "base/scoped_nsobject.h" #include "base/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" @@ -101,3 +102,26 @@ TEST_F(MacUtilTest, TestGetAppBundlePath) { out.value().c_str()) << "loop: " << i; } } + +TEST_F(MacUtilTest, TestExcludeFileFromBackups) { + NSString* homeDirectory = NSHomeDirectory(); + NSString* dummyFilePath = + [homeDirectory stringByAppendingPathComponent:@"DummyFile"]; + const char* dummy_file_path = [dummyFilePath fileSystemRepresentation]; + ASSERT_TRUE(dummy_file_path); + FilePath file_path(dummy_file_path); + // It is not actually necessary to have a physical file in order to + // set its exclusion property. + NSURL* fileURL = [NSURL URLWithString:dummyFilePath]; + // Reset the exclusion in case it was set previously. + mac_util::SetFileBackupExclusion(file_path, false); + Boolean excludeByPath; + // Initial state should be non-excluded. + EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); + // Exclude the file. + EXPECT_TRUE(mac_util::SetFileBackupExclusion(file_path, true)); + EXPECT_TRUE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); + // Un-exclude the file. + EXPECT_TRUE(mac_util::SetFileBackupExclusion(file_path, false)); + EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); +} |