OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/fileapi/external_file_url_util.h" | 5 #include "chrome/browser/chromeos/fileapi/external_file_url_util.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.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_browser_process.h" | 9 #include "chrome/test/base/testing_browser_process.h" |
10 #include "chrome/test/base/testing_profile_manager.h" | 10 #include "chrome/test/base/testing_profile_manager.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 base::string16 utf16_string; | 73 base::string16 utf16_string; |
74 utf16_string.push_back(0x307b); // HIRAGANA_LETTER_HO | 74 utf16_string.push_back(0x307b); // HIRAGANA_LETTER_HO |
75 utf16_string.push_back(0x3052); // HIRAGANA_LETTER_GE | 75 utf16_string.push_back(0x3052); // HIRAGANA_LETTER_GE |
76 url = CreateExpectedURL( | 76 url = CreateExpectedURL( |
77 base::FilePath::FromUTF8Unsafe(base::UTF16ToUTF8(utf16_string) + ".txt")); | 77 base::FilePath::FromUTF8Unsafe(base::UTF16ToUTF8(utf16_string) + ".txt")); |
78 EXPECT_EQ(url.virtual_path().AsUTF8Unsafe(), | 78 EXPECT_EQ(url.virtual_path().AsUTF8Unsafe(), |
79 ExternalFileURLToVirtualPath(FileSystemURLToExternalFileURL(url)) | 79 ExternalFileURLToVirtualPath(FileSystemURLToExternalFileURL(url)) |
80 .AsUTF8Unsafe()); | 80 .AsUTF8Unsafe()); |
81 } | 81 } |
82 | 82 |
83 TEST_F(ExternalFileURLUtilTest, ParseFileURLWithExternalFileOrigin) { | |
84 // filesystem:externalfile:/xxx is used only internally. It should not parsed | |
85 // directly. | |
86 ASSERT_FALSE(storage::FileSystemURL::CreateForTest( | |
87 GURL("filesystem:externalfile:/")).is_valid()); | |
88 ASSERT_FALSE(storage::FileSystemURL::CreateForTest( | |
89 GURL( | |
90 "filesystem:externalfile:/external/drive-test-user-hash/" | |
91 "file.txt")).is_valid()); | |
92 } | |
93 | |
94 } // namespace chromeos | 83 } // namespace chromeos |
OLD | NEW |