| OLD | NEW |
| 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 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include <errno.h> | 22 #include <errno.h> |
| 23 #include <sys/xattr.h> | 23 #include <sys/xattr.h> |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 namespace mac { | 26 namespace mac { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 typedef PlatformTest MacUtilTest; | 30 typedef PlatformTest MacUtilTest; |
| 31 | 31 |
| 32 TEST_F(MacUtilTest, TestFSRef) { | |
| 33 FSRef ref; | |
| 34 std::string path("/System/Library"); | |
| 35 | |
| 36 ASSERT_TRUE(FSRefFromPath(path, &ref)); | |
| 37 EXPECT_EQ(path, PathFromFSRef(ref)); | |
| 38 } | |
| 39 | |
| 40 TEST_F(MacUtilTest, GetUserDirectoryTest) { | 32 TEST_F(MacUtilTest, GetUserDirectoryTest) { |
| 41 // Try a few keys, make sure they come back with non-empty paths. | 33 // Try a few keys, make sure they come back with non-empty paths. |
| 42 FilePath caches_dir; | 34 FilePath caches_dir; |
| 43 EXPECT_TRUE(GetUserDirectory(NSCachesDirectory, &caches_dir)); | 35 EXPECT_TRUE(GetUserDirectory(NSCachesDirectory, &caches_dir)); |
| 44 EXPECT_FALSE(caches_dir.empty()); | 36 EXPECT_FALSE(caches_dir.empty()); |
| 45 | 37 |
| 46 FilePath application_support_dir; | 38 FilePath application_support_dir; |
| 47 EXPECT_TRUE(GetUserDirectory(NSApplicationSupportDirectory, | 39 EXPECT_TRUE(GetUserDirectory(NSApplicationSupportDirectory, |
| 48 &application_support_dir)); | 40 &application_support_dir)); |
| 49 EXPECT_FALSE(application_support_dir.empty()); | 41 EXPECT_FALSE(application_support_dir.empty()); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 261 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 270 FilePath non_existent_path = temp_dir_.GetPath().Append("DummyPath"); | 262 FilePath non_existent_path = temp_dir_.GetPath().Append("DummyPath"); |
| 271 ASSERT_FALSE(PathExists(non_existent_path)); | 263 ASSERT_FALSE(PathExists(non_existent_path)); |
| 272 EXPECT_FALSE(RemoveQuarantineAttribute(non_existent_path)); | 264 EXPECT_FALSE(RemoveQuarantineAttribute(non_existent_path)); |
| 273 } | 265 } |
| 274 | 266 |
| 275 } // namespace | 267 } // namespace |
| 276 | 268 |
| 277 } // namespace mac | 269 } // namespace mac |
| 278 } // namespace base | 270 } // namespace base |
| OLD | NEW |