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

Unified Diff: chrome/browser/chromeos/gdata/gdata_util_unittest.cc

Issue 10116044: gdata: Support mounting archive files in GData cache. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: gdata: Support mounting archive files in GData cache. Created 8 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
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_util.cc ('k') | chrome/browser/chromeos/gdata/mock_gdata_file_system.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_util_unittest.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_util_unittest.cc b/chrome/browser/chromeos/gdata/gdata_util_unittest.cc
index 1496e5d48e81ede983fbf4caf629109e71e0646b..b1cddcb43b428e32c1bc284691c7b0bc03c52471 100644
--- a/chrome/browser/chromeos/gdata/gdata_util_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_util_unittest.cc
@@ -51,5 +51,47 @@ TEST(GDataUtilTest, ExtractGDataPath) {
FilePath::FromUTF8Unsafe("/special/gdata/subdir/foo.txt")));
}
+TEST(GDataUtilTest, EscapeUnescapeCacheFileName) {
+ const std::string kUnescapedFileName(
+ "tmp:`~!@#$%^&*()-_=+[{|]}\\\\;\',<.>/?");
+ const std::string kEscapedFileName(
+ "tmp:`~!@#$%25^&*()-_=+[{|]}\\\\;\',<%2E>%2F?");
+ EXPECT_EQ(kEscapedFileName, EscapeCacheFileName(kUnescapedFileName));
+ EXPECT_EQ(kUnescapedFileName, UnescapeCacheFileName(kEscapedFileName));
+}
+
+TEST(GDataUtilTest, ParseCacheFilePath) {
+ std::string resource_id, md5, extra_extension;
+ ParseCacheFilePath(
+ FilePath::FromUTF8Unsafe(
+ "/home/user/GCache/v1/persistent/pdf:a1b2.0123456789abcdef.mounted"),
+ &resource_id,
+ &md5,
+ &extra_extension);
+ EXPECT_EQ(resource_id, "pdf:a1b2");
+ EXPECT_EQ(md5, "0123456789abcdef");
+ EXPECT_EQ(extra_extension, "mounted");
+
+ ParseCacheFilePath(
+ FilePath::FromUTF8Unsafe(
+ "/home/user/GCache/v1/tmp/pdf:a1b2.0123456789abcdef"),
+ &resource_id,
+ &md5,
+ &extra_extension);
+ EXPECT_EQ(resource_id, "pdf:a1b2");
+ EXPECT_EQ(md5, "0123456789abcdef");
+ EXPECT_EQ(extra_extension, "");
+
+ ParseCacheFilePath(
+ FilePath::FromUTF8Unsafe(
+ "/home/user/GCache/v1/pinned/pdf:a1b2"),
+ &resource_id,
+ &md5,
+ &extra_extension);
+ EXPECT_EQ(resource_id, "pdf:a1b2");
+ EXPECT_EQ(md5, "");
+ EXPECT_EQ(extra_extension, "");
+}
+
} // namespace util
} // namespace gdata
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_util.cc ('k') | chrome/browser/chromeos/gdata/mock_gdata_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698