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 #include "chrome/browser/chromeos/drive/file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/file_system_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/subdir/foo.txt"), | 85 EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/subdir/foo.txt"), |
86 ExtractDrivePath(base::FilePath::FromUTF8Unsafe( | 86 ExtractDrivePath(base::FilePath::FromUTF8Unsafe( |
87 "/special/drive/subdir/foo.txt"))); | 87 "/special/drive/subdir/foo.txt"))); |
88 } | 88 } |
89 | 89 |
90 TEST(FileSystemUtilTest, ExtractDrivePathFromFileSystemUrl) { | 90 TEST(FileSystemUtilTest, ExtractDrivePathFromFileSystemUrl) { |
91 // Set up file system context for testing. | 91 // Set up file system context for testing. |
92 base::ScopedTempDir temp_dir_; | 92 base::ScopedTempDir temp_dir_; |
93 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 93 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
94 | 94 |
95 MessageLoop message_loop; | 95 base::MessageLoop message_loop; |
96 scoped_refptr<fileapi::ExternalMountPoints> mount_points = | 96 scoped_refptr<fileapi::ExternalMountPoints> mount_points = |
97 fileapi::ExternalMountPoints::CreateRefCounted(); | 97 fileapi::ExternalMountPoints::CreateRefCounted(); |
98 scoped_refptr<fileapi::FileSystemContext> context( | 98 scoped_refptr<fileapi::FileSystemContext> context( |
99 new fileapi::FileSystemContext( | 99 new fileapi::FileSystemContext( |
100 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), | 100 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), |
101 mount_points, | 101 mount_points, |
102 NULL, // special_storage_policy | 102 NULL, // special_storage_policy |
103 NULL, // quota_manager_proxy, | 103 NULL, // quota_manager_proxy, |
104 ScopedVector<fileapi::FileSystemMountPointProvider>(), | 104 ScopedVector<fileapi::FileSystemMountPointProvider>(), |
105 temp_dir_.path(), // partition_path | 105 temp_dir_.path(), // partition_path |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 std::string data = "Hello world!"; | 321 std::string data = "Hello world!"; |
322 EXPECT_EQ(static_cast<int>(data.size()), | 322 EXPECT_EQ(static_cast<int>(data.size()), |
323 file_util::WriteFile(file, data.data(), data.size())); | 323 file_util::WriteFile(file, data.data(), data.size())); |
324 EXPECT_FALSE(HasGDocFileExtension(file)); | 324 EXPECT_FALSE(HasGDocFileExtension(file)); |
325 EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); | 325 EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); |
326 EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); | 326 EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); |
327 } | 327 } |
328 | 328 |
329 } // namespace util | 329 } // namespace util |
330 } // namespace drive | 330 } // namespace drive |
OLD | NEW |