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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc
diff --git a/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc
index 668a181c183dd3c564a73d918f27841c7b572f71..c591c1a7c901dd5c1a36bf89f01383f3f192d5fd 100644
--- a/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc
@@ -5,11 +5,37 @@
#include "chrome/browser/chromeos/drive/drive_file_system_util.h"
#include "base/files/file_path.h"
+#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace drive {
namespace util {
+TEST(DriveFileSystemUtilTest, FilePathToDriveURL) {
+ base::FilePath path;
+
+ // Path with alphabets and numbers.
+ path = GetDriveMyDriveRootPath().AppendASCII("foo/bar012.txt");
+ EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path)));
+
+ // Path with symbols.
+ path = GetDriveMyDriveRootPath().AppendASCII(
+ " !\"#$%&'()*+,-.:;<=>?@[\\]^_`{|}~");
+ EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path)));
+
+ // Path with '%'.
+ path = GetDriveMyDriveRootPath().AppendASCII("%19%20%21.txt");
+ EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path)));
+
+ // Path with multi byte characters.
+ string16 utf16_string;
+ utf16_string.push_back(0x307b); // HIRAGANA_LETTER_HO
+ utf16_string.push_back(0x3052); // HIRAGANA_LETTER_GE
+ path = GetDriveMyDriveRootPath().Append(
+ base::FilePath::FromUTF8Unsafe(UTF16ToUTF8(utf16_string) + ".txt"));
+ EXPECT_EQ(path, DriveURLToFilePath(FilePathToDriveURL(path)));
+}
+
TEST(DriveFileSystemUtilTest, IsUnderDriveMountPoint) {
EXPECT_FALSE(IsUnderDriveMountPoint(
base::FilePath::FromUTF8Unsafe("/wherever/foo.txt")));
« 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