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

Side by Side Diff: base/mac/mac_util_unittest.mm

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/json/json_value_serializer_unittest.cc ('k') | base/path_service_unittest.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 #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_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 TEST_F(MacUtilTest, TestExcludeFileFromBackups) { 103 TEST_F(MacUtilTest, TestExcludeFileFromBackups) {
104 // The file must already exist in order to set its exclusion property. 104 // The file must already exist in order to set its exclusion property.
105 ScopedTempDir temp_dir_; 105 ScopedTempDir temp_dir_;
106 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 106 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
107 FilePath dummy_file_path = temp_dir_.path().Append("DummyFile"); 107 FilePath dummy_file_path = temp_dir_.path().Append("DummyFile");
108 const char dummy_data[] = "All your base are belong to us!"; 108 const char dummy_data[] = "All your base are belong to us!";
109 // Dump something real into the file. 109 // Dump something real into the file.
110 ASSERT_EQ(static_cast<int>(arraysize(dummy_data)), 110 ASSERT_EQ(static_cast<int>(arraysize(dummy_data)),
111 file_util::WriteFile(dummy_file_path, dummy_data, arraysize(dummy_data))); 111 WriteFile(dummy_file_path, dummy_data, arraysize(dummy_data)));
112 NSString* fileURLString = 112 NSString* fileURLString =
113 [NSString stringWithUTF8String:dummy_file_path.value().c_str()]; 113 [NSString stringWithUTF8String:dummy_file_path.value().c_str()];
114 NSURL* fileURL = [NSURL URLWithString:fileURLString]; 114 NSURL* fileURL = [NSURL URLWithString:fileURLString];
115 // Initial state should be non-excluded. 115 // Initial state should be non-excluded.
116 EXPECT_FALSE(CSBackupIsItemExcluded(base::mac::NSToCFCast(fileURL), NULL)); 116 EXPECT_FALSE(CSBackupIsItemExcluded(base::mac::NSToCFCast(fileURL), NULL));
117 // Exclude the file. 117 // Exclude the file.
118 EXPECT_TRUE(SetFileBackupExclusion(dummy_file_path)); 118 EXPECT_TRUE(SetFileBackupExclusion(dummy_file_path));
119 // SetFileBackupExclusion never excludes by path. 119 // SetFileBackupExclusion never excludes by path.
120 Boolean excluded_by_path = FALSE; 120 Boolean excluded_by_path = FALSE;
121 Boolean excluded = 121 Boolean excluded =
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 253 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
254 FilePath non_existent_path = temp_dir_.path().Append("DummyPath"); 254 FilePath non_existent_path = temp_dir_.path().Append("DummyPath");
255 ASSERT_FALSE(PathExists(non_existent_path)); 255 ASSERT_FALSE(PathExists(non_existent_path));
256 EXPECT_FALSE(RemoveQuarantineAttribute(non_existent_path)); 256 EXPECT_FALSE(RemoveQuarantineAttribute(non_existent_path));
257 } 257 }
258 258
259 } // namespace 259 } // namespace
260 260
261 } // namespace mac 261 } // namespace mac
262 } // namespace base 262 } // namespace base
OLDNEW
« no previous file with comments | « base/json/json_value_serializer_unittest.cc ('k') | base/path_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698