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

Unified Diff: chrome/browser/chromeos/drive/file_system_util_unittest.cc

Issue 1296483003: Move chrome/browser/chromeos/drive/resource* (+deps) into components/drive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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");
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util.cc ('k') | chrome/browser/chromeos/drive/file_write_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698