Index: chrome/browser/chromeos/drive/file_system_util_unittest.cc |
diff --git a/chrome/browser/chromeos/drive/file_system_util_unittest.cc b/chrome/browser/chromeos/drive/file_system_util_unittest.cc |
index b471b5bea04a8459c5473d85e2f8401d31d87f87..4d288341531568f637bea6ae3793a5f0f451efe5 100644 |
--- a/chrome/browser/chromeos/drive/file_system_util_unittest.cc |
+++ b/chrome/browser/chromeos/drive/file_system_util_unittest.cc |
@@ -60,6 +60,45 @@ TEST_F(ProfileRelatedFileSystemUtilTest, GetDriveMountPointPath) { |
GetDriveMountPointPath(profile)); |
} |
+TEST_F(ProfileRelatedFileSystemUtilTest, IsUnderDriveMountPoint) { |
+ EXPECT_FALSE(IsUnderDriveMountPoint( |
+ base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); |
+ EXPECT_FALSE(IsUnderDriveMountPoint( |
+ base::FilePath::FromUTF8Unsafe("/special/foo.txt"))); |
+ EXPECT_FALSE(IsUnderDriveMountPoint( |
+ base::FilePath::FromUTF8Unsafe("special/drive/foo.txt"))); |
+ |
+ EXPECT_TRUE( |
+ IsUnderDriveMountPoint(base::FilePath::FromUTF8Unsafe("/special/drive"))); |
+ EXPECT_TRUE(IsUnderDriveMountPoint( |
+ base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); |
+ EXPECT_TRUE(IsUnderDriveMountPoint( |
+ base::FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt"))); |
+ EXPECT_TRUE(IsUnderDriveMountPoint( |
+ base::FilePath::FromUTF8Unsafe("/special/drive-xxx/foo.txt"))); |
+} |
+ |
+TEST_F(ProfileRelatedFileSystemUtilTest, ExtractDrivePath) { |
+ EXPECT_EQ( |
+ base::FilePath(), |
+ ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); |
+ EXPECT_EQ( |
+ base::FilePath(), |
+ ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/special/foo.txt"))); |
+ |
+ EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"), |
+ ExtractDrivePath(base::FilePath::FromUTF8Unsafe("/special/drive"))); |
+ EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/foo.txt"), |
+ ExtractDrivePath( |
+ base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); |
+ EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/subdir/foo.txt"), |
+ ExtractDrivePath(base::FilePath::FromUTF8Unsafe( |
+ "/special/drive/subdir/foo.txt"))); |
+ EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/foo.txt"), |
+ ExtractDrivePath( |
+ base::FilePath::FromUTF8Unsafe("/special/drive-xxx/foo.txt"))); |
+} |
+ |
TEST_F(ProfileRelatedFileSystemUtilTest, ExtractProfileFromPath) { |
Profile* profile1 = testing_profile_manager().CreateTestingProfile("user1"); |
Profile* profile2 = testing_profile_manager().CreateTestingProfile("user2"); |