| 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Path with symbols. | 32 // Path with symbols. |
| 33 path = GetDriveMyDriveRootPath().AppendASCII( | 33 path = GetDriveMyDriveRootPath().AppendASCII( |
| 34 " !\"#$%&'()*+,-.:;<=>?@[\\]^_`{|}~"); | 34 " !\"#$%&'()*+,-.:;<=>?@[\\]^_`{|}~"); |
| 35 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path))); | 35 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path))); |
| 36 | 36 |
| 37 // Path with '%'. | 37 // Path with '%'. |
| 38 path = GetDriveMyDriveRootPath().AppendASCII("%19%20%21.txt"); | 38 path = GetDriveMyDriveRootPath().AppendASCII("%19%20%21.txt"); |
| 39 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path))); | 39 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path))); |
| 40 | 40 |
| 41 // Path with multi byte characters. | 41 // Path with multi byte characters. |
| 42 string16 utf16_string; | 42 base::string16 utf16_string; |
| 43 utf16_string.push_back(0x307b); // HIRAGANA_LETTER_HO | 43 utf16_string.push_back(0x307b); // HIRAGANA_LETTER_HO |
| 44 utf16_string.push_back(0x3052); // HIRAGANA_LETTER_GE | 44 utf16_string.push_back(0x3052); // HIRAGANA_LETTER_GE |
| 45 path = GetDriveMyDriveRootPath().Append( | 45 path = GetDriveMyDriveRootPath().Append( |
| 46 base::FilePath::FromUTF8Unsafe(UTF16ToUTF8(utf16_string) + ".txt")); | 46 base::FilePath::FromUTF8Unsafe(UTF16ToUTF8(utf16_string) + ".txt")); |
| 47 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path))); | 47 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path))); |
| 48 } | 48 } |
| 49 | 49 |
| 50 TEST(FileSystemUtilTest, IsUnderDriveMountPoint) { | 50 TEST(FileSystemUtilTest, IsUnderDriveMountPoint) { |
| 51 EXPECT_FALSE(IsUnderDriveMountPoint( | 51 EXPECT_FALSE(IsUnderDriveMountPoint( |
| 52 base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); | 52 base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 file = temp_dir.path().AppendASCII("test.txt"); | 295 file = temp_dir.path().AppendASCII("test.txt"); |
| 296 std::string data = "Hello world!"; | 296 std::string data = "Hello world!"; |
| 297 EXPECT_TRUE(google_apis::test_util::WriteStringToFile(file, data)); | 297 EXPECT_TRUE(google_apis::test_util::WriteStringToFile(file, data)); |
| 298 EXPECT_FALSE(HasGDocFileExtension(file)); | 298 EXPECT_FALSE(HasGDocFileExtension(file)); |
| 299 EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); | 299 EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); |
| 300 EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); | 300 EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace util | 303 } // namespace util |
| 304 } // namespace drive | 304 } // namespace drive |
| OLD | NEW |