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

Side by Side Diff: webkit/fileapi/file_system_util_unittest.cc

Issue 14588006: Fix VirtualPath::GetNormalizedFilePath on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "webkit/fileapi/file_system_util.h" 5 #include "webkit/fileapi/file_system_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "webkit/fileapi/file_system_url.h" 10 #include "webkit/fileapi/file_system_url.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 TEST_F(FileSystemUtilTest, GetNormalizedFilePath) { 97 TEST_F(FileSystemUtilTest, GetNormalizedFilePath) {
98 struct test_data { 98 struct test_data {
99 const base::FilePath::StringType path; 99 const base::FilePath::StringType path;
100 const base::FilePath::StringType normalized_path; 100 const base::FilePath::StringType normalized_path;
101 } test_cases[] = { 101 } test_cases[] = {
102 { FILE_PATH_LITERAL(""), FILE_PATH_LITERAL("/") }, 102 { FILE_PATH_LITERAL(""), FILE_PATH_LITERAL("/") },
103 { FILE_PATH_LITERAL("/"), FILE_PATH_LITERAL("/") }, 103 { FILE_PATH_LITERAL("/"), FILE_PATH_LITERAL("/") },
104 { FILE_PATH_LITERAL("foo/bar"), FILE_PATH_LITERAL("/foo/bar") }, 104 { FILE_PATH_LITERAL("foo/bar"), FILE_PATH_LITERAL("/foo/bar") },
105 { FILE_PATH_LITERAL("/foo/bar"), FILE_PATH_LITERAL("/foo/bar") } 105 { FILE_PATH_LITERAL("/foo/bar"), FILE_PATH_LITERAL("/foo/bar") },
106 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
107 { FILE_PATH_LITERAL("\\foo"), FILE_PATH_LITERAL("/foo") },
108 #endif
106 }; 109 };
107 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { 110 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
108 base::FilePath input = base::FilePath(test_cases[i].path); 111 base::FilePath input = base::FilePath(test_cases[i].path);
109 base::FilePath::StringType normalized_path_string = 112 base::FilePath::StringType normalized_path_string =
110 VirtualPath::GetNormalizedFilePath(input); 113 VirtualPath::GetNormalizedFilePath(input);
111 EXPECT_EQ(test_cases[i].normalized_path, normalized_path_string); 114 EXPECT_EQ(test_cases[i].normalized_path, normalized_path_string);
112 } 115 }
113 } 116 }
114 117
115 TEST_F(FileSystemUtilTest, IsAbsolutePath) { 118 TEST_F(FileSystemUtilTest, IsAbsolutePath) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 218
216 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_a)); 219 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_a));
217 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_b)); 220 EXPECT_TRUE(AreSameFileSystem(url_foo_temp_a, url_foo_temp_b));
218 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_foo_perm_a)); 221 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_foo_perm_a));
219 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_temp_a)); 222 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_temp_a));
220 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_perm_a)); 223 EXPECT_FALSE(AreSameFileSystem(url_foo_temp_a, url_bar_perm_a));
221 } 224 }
222 225
223 } // namespace (anonymous) 226 } // namespace (anonymous)
224 } // namespace fileapi 227 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698