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

Side by Side Diff: chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc

Issue 13401003: chromeos: Replace resource ID in drive URL with path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unneeded include Created 7 years, 8 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
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 "chrome/browser/chromeos/drive/drive_file_system_util.h" 5 #include "chrome/browser/chromeos/drive/drive_file_system_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 namespace drive { 11 namespace drive {
11 namespace util { 12 namespace util {
12 13
14 TEST(DriveFileSystemUtilTest, FilePathToDriveURL) {
15 base::FilePath path;
16
17 // Path with alphabets and numbers.
18 path = GetDriveMyDriveRootPath().AppendASCII("foo/bar012.txt");
19 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path)));
20
21 // Path with symbols.
22 path = GetDriveMyDriveRootPath().AppendASCII(
23 " !\"#$%&'()*+,-.:;<=>?@[\\]^_`{|}~");
24 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path)));
25
26 // Path with '%'.
27 path = GetDriveMyDriveRootPath().AppendASCII("%19%20%21.txt");
28 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path)));
29
30 // Path with multi byte characters.
31 string16 utf16_string;
32 utf16_string.push_back(0x307b); // HIRAGANA_LETTER_HO
33 utf16_string.push_back(0x3052); // HIRAGANA_LETTER_GE
34 path = GetDriveMyDriveRootPath().Append(
35 base::FilePath::FromUTF8Unsafe(UTF16ToUTF8(utf16_string) + ".txt"));
36 EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path)));
37 }
38
13 TEST(DriveFileSystemUtilTest, IsUnderDriveMountPoint) { 39 TEST(DriveFileSystemUtilTest, IsUnderDriveMountPoint) {
14 EXPECT_FALSE(IsUnderDriveMountPoint( 40 EXPECT_FALSE(IsUnderDriveMountPoint(
15 base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); 41 base::FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
16 EXPECT_FALSE(IsUnderDriveMountPoint( 42 EXPECT_FALSE(IsUnderDriveMountPoint(
17 base::FilePath::FromUTF8Unsafe("/special/foo.txt"))); 43 base::FilePath::FromUTF8Unsafe("/special/foo.txt")));
18 EXPECT_FALSE(IsUnderDriveMountPoint( 44 EXPECT_FALSE(IsUnderDriveMountPoint(
19 base::FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); 45 base::FilePath::FromUTF8Unsafe("/special/drivex/foo.txt")));
20 EXPECT_FALSE(IsUnderDriveMountPoint( 46 EXPECT_FALSE(IsUnderDriveMountPoint(
21 base::FilePath::FromUTF8Unsafe("special/drivex/foo.txt"))); 47 base::FilePath::FromUTF8Unsafe("special/drivex/foo.txt")));
22 48
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 EXPECT_FALSE(util::IsSpecialResourceId("file:123")); 187 EXPECT_FALSE(util::IsSpecialResourceId("file:123"));
162 EXPECT_FALSE(util::IsSpecialResourceId("folder:root")); 188 EXPECT_FALSE(util::IsSpecialResourceId("folder:root"));
163 EXPECT_FALSE(util::IsSpecialResourceId("folder:xyz")); 189 EXPECT_FALSE(util::IsSpecialResourceId("folder:xyz"));
164 190
165 EXPECT_TRUE(util::IsSpecialResourceId("<drive>")); 191 EXPECT_TRUE(util::IsSpecialResourceId("<drive>"));
166 EXPECT_TRUE(util::IsSpecialResourceId("<other>")); 192 EXPECT_TRUE(util::IsSpecialResourceId("<other>"));
167 } 193 }
168 194
169 } // namespace util 195 } // namespace util
170 } // namespace drive 196 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system_util.cc ('k') | chrome/browser/chromeos/drive/drive_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698