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

Side by Side Diff: net/base/directory_listing_unittest.cc

Issue 1548503002: net: extract GetDirectoryListingXXX functions into directory_listing.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 4 years, 11 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
« no previous file with comments | « net/base/directory_listing.cc ('k') | net/base/net_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/base/net_util.h" 5 #include "net/base/directory_listing.h"
6
7 #include <stdint.h>
8
9 #include <string>
10 6
11 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h" 8 #include "base/time/time.h"
13 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
14 #include "url/gurl.h"
15 10
16 namespace net { 11 namespace net {
17 12
18 namespace { 13 namespace {
19 14
20 struct GetDirectoryListingEntryCase { 15 struct GetDirectoryListingEntryCase {
21 const wchar_t* name; 16 const wchar_t* name;
22 const char* const raw_bytes; 17 const char* const raw_bytes;
23 bool is_dir; 18 bool is_dir;
24 int64_t filesize; 19 int64_t filesize;
25 base::Time time; 20 base::Time time;
26 const char* const expected; 21 const char* const expected;
27 }; 22 };
28 23
29 TEST(NetUtilTest, GetDirectoryListingEntry) { 24 TEST(DirectoryListingTest, GetDirectoryListingEntry) {
30 const GetDirectoryListingEntryCase test_cases[] = { 25 const GetDirectoryListingEntryCase test_cases[] = {
31 {L"Foo", 26 {L"Foo",
32 "", 27 "",
33 false, 28 false,
34 10000, 29 10000,
35 base::Time(), 30 base::Time(),
36 "<script>addRow(\"Foo\",\"Foo\",0,\"9.8 kB\",\"\");</script>\n"}, 31 "<script>addRow(\"Foo\",\"Foo\",0,\"9.8 kB\",\"\");</script>\n"},
37 {L"quo\"tes", 32 {L"quo\"tes",
38 "", 33 "",
39 false, 34 false,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const std::string results = GetDirectoryListingEntry( 67 const std::string results = GetDirectoryListingEntry(
73 base::WideToUTF16(test_cases[i].name), test_cases[i].raw_bytes, 68 base::WideToUTF16(test_cases[i].name), test_cases[i].raw_bytes,
74 test_cases[i].is_dir, test_cases[i].filesize, test_cases[i].time); 69 test_cases[i].is_dir, test_cases[i].filesize, test_cases[i].time);
75 EXPECT_EQ(test_cases[i].expected, results); 70 EXPECT_EQ(test_cases[i].expected, results);
76 } 71 }
77 } 72 }
78 73
79 } // namespace 74 } // namespace
80 75
81 } // namespace net 76 } // namespace net
OLDNEW
« no previous file with comments | « net/base/directory_listing.cc ('k') | net/base/net_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698