Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 NSString* dummyFilePath = | 99 NSString* dummyFilePath = |
| 100 [homeDirectory stringByAppendingPathComponent:@"DummyFile"]; | 100 [homeDirectory stringByAppendingPathComponent:@"DummyFile"]; |
| 101 const char* dummy_file_path = [dummyFilePath fileSystemRepresentation]; | 101 const char* dummy_file_path = [dummyFilePath fileSystemRepresentation]; |
| 102 ASSERT_TRUE(dummy_file_path); | 102 ASSERT_TRUE(dummy_file_path); |
| 103 FilePath file_path(dummy_file_path); | 103 FilePath file_path(dummy_file_path); |
| 104 // It is not actually necessary to have a physical file in order to | 104 // It is not actually necessary to have a physical file in order to |
| 105 // set its exclusion property. | 105 // set its exclusion property. |
| 106 NSURL* fileURL = [NSURL URLWithString:dummyFilePath]; | 106 NSURL* fileURL = [NSURL URLWithString:dummyFilePath]; |
| 107 // Reset the exclusion in case it was set previously. | 107 // Reset the exclusion in case it was set previously. |
| 108 SetFileBackupExclusion(file_path, false); | 108 SetFileBackupExclusion(file_path, false); |
| 109 Boolean excludeByPath; | |
| 110 // Initial state should be non-excluded. | 109 // Initial state should be non-excluded. |
| 111 EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); | 110 EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, NULL)); |
| 112 // Exclude the file. | 111 // Exclude the file. |
| 113 EXPECT_TRUE(SetFileBackupExclusion(file_path, true)); | 112 EXPECT_TRUE(SetFileBackupExclusion(file_path, true)); |
| 114 EXPECT_TRUE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); | 113 EXPECT_TRUE(CSBackupIsItemExcluded((CFURLRef)fileURL, NULL)); |
| 115 // Un-exclude the file. | 114 // Un-exclude the file. |
| 116 EXPECT_TRUE(SetFileBackupExclusion(file_path, false)); | 115 EXPECT_TRUE(SetFileBackupExclusion(file_path, false)); |
|
Mark Mentovai
2011/05/25 01:14:35
This (and line 108) is the portion of the test tha
mrossetti
2011/05/26 21:02:40
Done.
| |
| 117 EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); | 116 EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, NULL)); |
| 118 } | 117 } |
| 119 | 118 |
| 120 TEST_F(MacUtilTest, TestGetValueFromDictionary) { | 119 TEST_F(MacUtilTest, TestGetValueFromDictionary) { |
| 121 ScopedCFTypeRef<CFMutableDictionaryRef> dict( | 120 ScopedCFTypeRef<CFMutableDictionaryRef> dict( |
| 122 CFDictionaryCreateMutable(0, 0, | 121 CFDictionaryCreateMutable(0, 0, |
| 123 &kCFTypeDictionaryKeyCallBacks, | 122 &kCFTypeDictionaryKeyCallBacks, |
| 124 &kCFTypeDictionaryValueCallBacks)); | 123 &kCFTypeDictionaryValueCallBacks)); |
| 125 CFDictionarySetValue(dict.get(), CFSTR("key"), CFSTR("value")); | 124 CFDictionarySetValue(dict.get(), CFSTR("key"), CFSTR("value")); |
| 126 | 125 |
| 127 EXPECT_TRUE(CFEqual(CFSTR("value"), | 126 EXPECT_TRUE(CFEqual(CFSTR("value"), |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 154 EXPECT_EQ(2U, [array retainCount]); | 153 EXPECT_EQ(2U, [array retainCount]); |
| 155 | 154 |
| 156 NSObjectRelease(array); | 155 NSObjectRelease(array); |
| 157 EXPECT_EQ(1U, [array retainCount]); | 156 EXPECT_EQ(1U, [array retainCount]); |
| 158 } | 157 } |
| 159 | 158 |
| 160 } // namespace | 159 } // namespace |
| 161 | 160 |
| 162 } // namespace mac | 161 } // namespace mac |
| 163 } // namespace base | 162 } // namespace base |
| OLD | NEW |