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

Unified Diff: net/base/net_util_unittest.cc

Issue 419: Fix a crash caused by a NULL FILETIME when creating ftp... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 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
« net/base/net_util.cc ('K') | « net/base/net_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util_unittest.cc
===================================================================
--- net/base/net_util_unittest.cc (revision 1680)
+++ net/base/net_util_unittest.cc (working copy)
@@ -698,3 +698,38 @@
}
}
+// This is currently a windows specific function.
+#if defined(OS_WIN)
+namespace {
+
+struct GetDirectoryListingEntryCase {
+ const char* name;
+ DWORD file_attrib;
+ int64 filesize;
+ FILETIME* modified;
+ const char* expected;
+};
+
+} // namespace
+TEST(NetUtilTest, GetDirectoryListingEntry) {
+ const GetDirectoryListingEntryCase test_cases[] = {
+ {"Foo",
+ 0,
+ 10000,
+ NULL,
+ "<script>addRow(\"Foo\",\"Foo\",0,\"9.8 kB\",\"\");</script>\n"},
+ {"quo\"tes",
+ 0,
+ 10000,
+ NULL,
+ "<script>addRow(\"quo\\\"tes\",\"quo%22tes\",0,\"9.8 kB\",\"\");</script>\n"},
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
+ const std::string results = net::GetDirectoryListingEntry(
+ test_cases[i].name, test_cases[i].file_attrib,
+ test_cases[i].filesize, test_cases[i].modified);
+ EXPECT_EQ(test_cases[i].expected, results);
+ }
+}
+#endif
« net/base/net_util.cc ('K') | « net/base/net_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698