Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/net_util.h" |
|
tfarina
2015/12/21 20:47:47
note for myself: update this!
| |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | |
| 9 #include <string> | 8 #include <string> |
| 10 | 9 |
| 11 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 15 | 14 |
| 16 namespace net { | 15 namespace net { |
| 17 | 16 |
| 18 namespace { | 17 namespace { |
| 19 | 18 |
| 20 struct GetDirectoryListingEntryCase { | 19 struct GetDirectoryListingEntryCase { |
| 21 const wchar_t* name; | 20 const wchar_t* name; |
| 22 const char* const raw_bytes; | 21 const char* const raw_bytes; |
| 23 bool is_dir; | 22 bool is_dir; |
| 24 int64_t filesize; | 23 int64_t filesize; |
| 25 base::Time time; | 24 base::Time time; |
| 26 const char* const expected; | 25 const char* const expected; |
| 27 }; | 26 }; |
| 28 | 27 |
| 29 TEST(NetUtilTest, GetDirectoryListingEntry) { | 28 TEST(NetUtilTest, GetDirectoryListingEntry) { |
|
tfarina
2015/12/21 20:47:47
note for myself: update this!
| |
| 30 const GetDirectoryListingEntryCase test_cases[] = { | 29 const GetDirectoryListingEntryCase test_cases[] = { |
| 31 {L"Foo", | 30 {L"Foo", |
| 32 "", | 31 "", |
| 33 false, | 32 false, |
| 34 10000, | 33 10000, |
| 35 base::Time(), | 34 base::Time(), |
| 36 "<script>addRow(\"Foo\",\"Foo\",0,\"9.8 kB\",\"\");</script>\n"}, | 35 "<script>addRow(\"Foo\",\"Foo\",0,\"9.8 kB\",\"\");</script>\n"}, |
| 37 {L"quo\"tes", | 36 {L"quo\"tes", |
| 38 "", | 37 "", |
| 39 false, | 38 false, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 const std::string results = GetDirectoryListingEntry( | 71 const std::string results = GetDirectoryListingEntry( |
| 73 base::WideToUTF16(test_cases[i].name), test_cases[i].raw_bytes, | 72 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); | 73 test_cases[i].is_dir, test_cases[i].filesize, test_cases[i].time); |
| 75 EXPECT_EQ(test_cases[i].expected, results); | 74 EXPECT_EQ(test_cases[i].expected, results); |
| 76 } | 75 } |
| 77 } | 76 } |
| 78 | 77 |
| 79 } // namespace | 78 } // namespace |
| 80 | 79 |
| 81 } // namespace net | 80 } // namespace net |
| OLD | NEW |