| Index: components/url_formatter/url_formatter_unittest.cc
|
| diff --git a/net/base/net_util_icu_unittest.cc b/components/url_formatter/url_formatter_unittest.cc
|
| similarity index 95%
|
| copy from net/base/net_util_icu_unittest.cc
|
| copy to components/url_formatter/url_formatter_unittest.cc
|
| index f643426aa678ed48f36e96877adde254a26624b5..0d446a8bec9a3b021f4c1ed1c53c49da0678f9e3 100644
|
| --- a/net/base/net_util_icu_unittest.cc
|
| +++ b/components/url_formatter/url_formatter_unittest.cc
|
| @@ -1,28 +1,27 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "net/base/net_util.h"
|
| +#include "components/url_formatter/url_formatter.h"
|
|
|
| #include <string.h>
|
|
|
| #include <vector>
|
|
|
| -#include "base/format_macros.h"
|
| -#include "base/strings/string_number_conversions.h"
|
| +#include "base/macros.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| -#include "base/time/time.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "url/gurl.h"
|
|
|
| -using base::ASCIIToUTF16;
|
| -using base::WideToUTF16;
|
|
|
| -namespace net {
|
| +namespace url_formatter {
|
|
|
| namespace {
|
|
|
| +using base::WideToUTF16;
|
| +using base::ASCIIToUTF16;
|
| +
|
| const size_t kNpos = base::string16::npos;
|
|
|
| const char* const kLanguages[] = {
|
| @@ -424,8 +423,6 @@ void CheckAdjustedOffsets(const std::string& url_string,
|
| std::string::npos, formatted_url);
|
| }
|
|
|
| -} // anonymous namespace
|
| -
|
| TEST(NetUtilTest, IDNToUnicodeFast) {
|
| for (size_t i = 0; i < arraysize(idn_cases); i++) {
|
| for (size_t j = 0; j < arraysize(kLanguages); j++) {
|
| @@ -481,76 +478,6 @@ TEST(NetUtilTest, StripWWW) {
|
| EXPECT_EQ(ASCIIToUTF16("blah"), StripWWW(ASCIIToUTF16("blah")));
|
| }
|
|
|
| -// This is currently a windows specific function.
|
| -#if defined(OS_WIN)
|
| -namespace {
|
| -
|
| -struct GetDirectoryListingEntryCase {
|
| - const wchar_t* name;
|
| - const char* const raw_bytes;
|
| - bool is_dir;
|
| - int64_t filesize;
|
| - base::Time time;
|
| - const char* const expected;
|
| -};
|
| -
|
| -} // namespace
|
| -
|
| -TEST(NetUtilTest, GetDirectoryListingEntry) {
|
| - const GetDirectoryListingEntryCase test_cases[] = {
|
| - {L"Foo",
|
| - "",
|
| - false,
|
| - 10000,
|
| - base::Time(),
|
| - "<script>addRow(\"Foo\",\"Foo\",0,\"9.8 kB\",\"\");</script>\n"},
|
| - {L"quo\"tes",
|
| - "",
|
| - false,
|
| - 10000,
|
| - base::Time(),
|
| - "<script>addRow(\"quo\\\"tes\",\"quo%22tes\",0,\"9.8 kB\",\"\");</script>"
|
| - "\n"},
|
| - {L"quo\"tes",
|
| - "quo\"tes",
|
| - false,
|
| - 10000,
|
| - base::Time(),
|
| - "<script>addRow(\"quo\\\"tes\",\"quo%22tes\",0,\"9.8 kB\",\"\");</script>"
|
| - "\n"},
|
| - // U+D55C0 U+AE00. raw_bytes is empty (either a local file with
|
| - // UTF-8/UTF-16 encoding or a remote file on an ftp server using UTF-8
|
| - {L"\xD55C\xAE00.txt",
|
| - "",
|
| - false,
|
| - 10000,
|
| - base::Time(),
|
| - "<script>addRow(\"\xED\x95\x9C\xEA\xB8\x80.txt\","
|
| - "\"%ED%95%9C%EA%B8%80.txt\",0,\"9.8 kB\",\"\");</script>\n"},
|
| - // U+D55C0 U+AE00. raw_bytes is the corresponding EUC-KR sequence:
|
| - // a local or remote file in EUC-KR.
|
| - {L"\xD55C\xAE00.txt",
|
| - "\xC7\xD1\xB1\xDB.txt",
|
| - false,
|
| - 10000,
|
| - base::Time(),
|
| - "<script>addRow(\"\xED\x95\x9C\xEA\xB8\x80.txt\",\"%C7%D1%B1%DB.txt\""
|
| - ",0,\"9.8 kB\",\"\");</script>\n"},
|
| - };
|
| -
|
| - for (size_t i = 0; i < arraysize(test_cases); ++i) {
|
| - const std::string results = GetDirectoryListingEntry(
|
| - WideToUTF16(test_cases[i].name),
|
| - test_cases[i].raw_bytes,
|
| - test_cases[i].is_dir,
|
| - test_cases[i].filesize,
|
| - test_cases[i].time);
|
| - EXPECT_EQ(test_cases[i].expected, results);
|
| - }
|
| -}
|
| -
|
| -#endif
|
| -
|
| TEST(NetUtilTest, FormatUrl) {
|
| FormatUrlTypes default_format_type = kFormatUrlOmitUsernamePassword;
|
| const UrlTestData tests[] = {
|
| @@ -1100,4 +1027,6 @@ TEST(NetUtilTest, FormatUrlWithOffsets) {
|
| UnescapeRule::NORMAL, omit_all_offsets);
|
| }
|
|
|
| -} // namespace net
|
| +} // namespace
|
| +
|
| +} // namespace url_formatter
|
|
|