OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/chromeos/file_manager/path_util.h" | 5 #include "chrome/browser/chromeos/file_manager/path_util.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "chrome/browser/chromeos/drive/file_system_util.h" | 8 #include "chrome/browser/chromeos/drive/file_system_util.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 TEST(FileManagerPathUtilTest, MultiProfileDriveFolderMigration) { | 50 TEST(FileManagerPathUtilTest, MultiProfileDriveFolderMigration) { |
51 TestingProfile profile; | 51 TestingProfile profile; |
52 | 52 |
53 // This looks like "/special/drive-xxx" in the production | 53 // This looks like "/special/drive-xxx" in the production |
54 // environment. | 54 // environment. |
55 const base::FilePath kDrive = drive::util::GetDriveMountPointPath(&profile); | 55 const base::FilePath kDrive = drive::util::GetDriveMountPointPath(&profile); |
56 | 56 |
57 base::FilePath path; | 57 base::FilePath path; |
58 | 58 |
59 // TODO(kinaba): add test, once after drive::util::GetDriveMountPointPath is | 59 EXPECT_TRUE(MigratePathFromOldFormat( |
60 // implemented in the way that takes profile into account | 60 &profile, |
| 61 base::FilePath::FromUTF8Unsafe("/special/drive"), |
| 62 &path)); |
| 63 EXPECT_EQ(kDrive, path); |
| 64 |
| 65 EXPECT_TRUE(MigratePathFromOldFormat( |
| 66 &profile, |
| 67 base::FilePath::FromUTF8Unsafe("/special/drive/a/b"), |
| 68 &path)); |
| 69 EXPECT_EQ(kDrive.AppendASCII("a/b"), path); |
| 70 |
| 71 // Path already in the new format is not converted. |
| 72 EXPECT_FALSE(MigratePathFromOldFormat( |
| 73 &profile, |
| 74 kDrive.AppendASCII("a/b"), |
| 75 &path)); |
61 | 76 |
62 // Only the "/special/drive" path is converted. | 77 // Only the "/special/drive" path is converted. |
63 EXPECT_FALSE(MigratePathFromOldFormat( | 78 EXPECT_FALSE(MigratePathFromOldFormat( |
64 &profile, | 79 &profile, |
65 base::FilePath::FromUTF8Unsafe("/special/notdrive"), | 80 base::FilePath::FromUTF8Unsafe("/special/notdrive"), |
66 &path)); | 81 &path)); |
67 } | 82 } |
68 | 83 |
69 } // namespace | 84 } // namespace |
70 } // namespace util | 85 } // namespace util |
71 } // namespace file_manager | 86 } // namespace file_manager |
OLD | NEW |