| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 EXPECT_EQ( | 192 EXPECT_EQ( |
| 193 base::FilePath(), | 193 base::FilePath(), |
| 194 ExtractDrivePathFromFileSystemUrl(context->CrackURL(GURL( | 194 ExtractDrivePathFromFileSystemUrl(context->CrackURL(GURL( |
| 195 "filesystem:chrome-extension://dummy-id/external/Downloads/foo")))); | 195 "filesystem:chrome-extension://dummy-id/external/Downloads/foo")))); |
| 196 | 196 |
| 197 // Type:"isolated" + virtual_path:"isolated_id/name" mapped on a Drive path. | 197 // Type:"isolated" + virtual_path:"isolated_id/name" mapped on a Drive path. |
| 198 std::string isolated_name; | 198 std::string isolated_name; |
| 199 std::string isolated_id = | 199 std::string isolated_id = |
| 200 fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForPath( | 200 fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForPath( |
| 201 fileapi::kFileSystemTypeNativeForPlatformApp, | 201 fileapi::kFileSystemTypeNativeForPlatformApp, |
| 202 std::string(), |
| 202 GetDriveMountPointPath(&profile).AppendASCII("bar/buz"), | 203 GetDriveMountPointPath(&profile).AppendASCII("bar/buz"), |
| 203 &isolated_name); | 204 &isolated_name); |
| 204 EXPECT_EQ( | 205 EXPECT_EQ( |
| 205 base::FilePath::FromUTF8Unsafe("drive/bar/buz"), | 206 base::FilePath::FromUTF8Unsafe("drive/bar/buz"), |
| 206 ExtractDrivePathFromFileSystemUrl(context->CrackURL(GURL( | 207 ExtractDrivePathFromFileSystemUrl(context->CrackURL(GURL( |
| 207 "filesystem:chrome-extension://dummy-id/isolated/" + | 208 "filesystem:chrome-extension://dummy-id/isolated/" + |
| 208 isolated_id + "/" + isolated_name)))); | 209 isolated_id + "/" + isolated_name)))); |
| 209 } | 210 } |
| 210 | 211 |
| 211 TEST(FileSystemUtilTest, EscapeUnescapeCacheFileName) { | 212 TEST(FileSystemUtilTest, EscapeUnescapeCacheFileName) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 file = temp_dir.path().AppendASCII("test.txt"); | 295 file = temp_dir.path().AppendASCII("test.txt"); |
| 295 std::string data = "Hello world!"; | 296 std::string data = "Hello world!"; |
| 296 EXPECT_TRUE(google_apis::test_util::WriteStringToFile(file, data)); | 297 EXPECT_TRUE(google_apis::test_util::WriteStringToFile(file, data)); |
| 297 EXPECT_FALSE(HasGDocFileExtension(file)); | 298 EXPECT_FALSE(HasGDocFileExtension(file)); |
| 298 EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); | 299 EXPECT_TRUE(ReadUrlFromGDocFile(file).is_empty()); |
| 299 EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); | 300 EXPECT_TRUE(ReadResourceIdFromGDocFile(file).empty()); |
| 300 } | 301 } |
| 301 | 302 |
| 302 } // namespace util | 303 } // namespace util |
| 303 } // namespace drive | 304 } // namespace drive |
| OLD | NEW |