Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(904)

Side by Side Diff: chrome/browser/chromeos/fileapi/external_file_url_util_unittest.cc

Issue 2437693002: arc: Add URL converter functions (Closed)
Patch Set: Add test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/test/base/testing_browser_process.h" 8 #include "chrome/test/base/testing_browser_process.h"
9 #include "chrome/test/base/testing_profile_manager.h" 9 #include "chrome/test/base/testing_profile_manager.h"
10 #include "components/drive/file_system_core_util.h" 10 #include "components/drive/file_system_core_util.h"
11 #include "content/public/common/url_constants.h"
11 #include "content/public/test/test_browser_thread_bundle.h" 12 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "storage/browser/fileapi/file_system_url.h" 13 #include "storage/browser/fileapi/file_system_url.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace chromeos { 16 namespace chromeos {
16 17
17 namespace { 18 namespace {
18 19
19 // Sets up ProfileManager for testing and marks the current thread as UI by 20 // Sets up ProfileManager for testing and marks the current thread as UI by
20 // TestBrowserThreadBundle. We need the thread since Profile objects must be 21 // TestBrowserThreadBundle. We need the thread since Profile objects must be
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 base::string16 utf16_string; 72 base::string16 utf16_string;
72 utf16_string.push_back(0x307b); // HIRAGANA_LETTER_HO 73 utf16_string.push_back(0x307b); // HIRAGANA_LETTER_HO
73 utf16_string.push_back(0x3052); // HIRAGANA_LETTER_GE 74 utf16_string.push_back(0x3052); // HIRAGANA_LETTER_GE
74 url = CreateExpectedURL( 75 url = CreateExpectedURL(
75 base::FilePath::FromUTF8Unsafe(base::UTF16ToUTF8(utf16_string) + ".txt")); 76 base::FilePath::FromUTF8Unsafe(base::UTF16ToUTF8(utf16_string) + ".txt"));
76 EXPECT_EQ(url.virtual_path().AsUTF8Unsafe(), 77 EXPECT_EQ(url.virtual_path().AsUTF8Unsafe(),
77 ExternalFileURLToVirtualPath(FileSystemURLToExternalFileURL(url)) 78 ExternalFileURLToVirtualPath(FileSystemURLToExternalFileURL(url))
78 .AsUTF8Unsafe()); 79 .AsUTF8Unsafe());
79 } 80 }
80 81
82 TEST_F(ExternalFileURLUtilTest, VirtualPathToExternalFileURL) {
83 base::FilePath virtual_path(FILE_PATH_LITERAL("foo/bar012.txt"));
84 GURL result = VirtualPathToExternalFileURL(virtual_path);
85 EXPECT_TRUE(result.is_valid());
86 EXPECT_EQ(content::kExternalFileScheme, result.scheme());
87 EXPECT_EQ(virtual_path.value(), ExternalFileURLToVirtualPath(result).value());
88 }
89
81 } // namespace chromeos 90 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698