| Index: url/gurl_unittest.cc
|
| diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc
|
| index f38d7f9704e7d532b87dfb1315ff8d9e64b57a61..3e945505fc628fc09bd0d6ab0fd03915d8b2dff4 100644
|
| --- a/url/gurl_unittest.cc
|
| +++ b/url/gurl_unittest.cc
|
| @@ -2,18 +2,12 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "base/macros.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "url/gurl.h"
|
| #include "url/url_canon.h"
|
| #include "url/url_test_utils.h"
|
|
|
| -// Some implementations of base/basictypes.h may define ARRAYSIZE.
|
| -// If it's not defined, we define it to the ARRAYSIZE_UNSAFE macro
|
| -// which is in our version of basictypes.h.
|
| -#ifndef ARRAYSIZE
|
| -#define ARRAYSIZE ARRAYSIZE_UNSAFE
|
| -#endif
|
| -
|
| namespace url {
|
|
|
| using test_utils::WStringToUTF16;
|
| @@ -232,7 +226,7 @@ TEST(GURLTest, IsValid) {
|
| "http:path",
|
| "://google.com",
|
| };
|
| - for (size_t i = 0; i < ARRAYSIZE(valid_cases); i++) {
|
| + for (size_t i = 0; i < arraysize(valid_cases); i++) {
|
| EXPECT_TRUE(GURL(valid_cases[i]).is_valid())
|
| << "Case: " << valid_cases[i];
|
| }
|
| @@ -244,7 +238,7 @@ TEST(GURLTest, IsValid) {
|
| "http://google.com:12three45",
|
| "path",
|
| };
|
| - for (size_t i = 0; i < ARRAYSIZE(invalid_cases); i++) {
|
| + for (size_t i = 0; i < arraysize(invalid_cases); i++) {
|
| EXPECT_FALSE(GURL(invalid_cases[i]).is_valid())
|
| << "Case: " << invalid_cases[i];
|
| }
|
| @@ -299,7 +293,7 @@ TEST(GURLTest, Resolve) {
|
| {"filesystem:http://www.google.com/type/", "../foo.html", true, "filesystem:http://www.google.com/type/foo.html"},
|
| };
|
|
|
| - for (size_t i = 0; i < ARRAYSIZE(resolve_cases); i++) {
|
| + for (size_t i = 0; i < arraysize(resolve_cases); i++) {
|
| // 8-bit code path.
|
| GURL input(resolve_cases[i].base);
|
| GURL output = input.Resolve(resolve_cases[i].relative);
|
| @@ -331,7 +325,7 @@ TEST(GURLTest, GetOrigin) {
|
| {"filesystem:http://www.google.com/temp/foo?q#b", "http://www.google.com/"},
|
| {"filesystem:http://user:pass@google.com:21/blah#baz", "http://google.com:21/"},
|
| };
|
| - for (size_t i = 0; i < ARRAYSIZE(cases); i++) {
|
| + for (size_t i = 0; i < arraysize(cases); i++) {
|
| GURL url(cases[i].input);
|
| GURL origin = url.GetOrigin();
|
| EXPECT_EQ(cases[i].expected, origin.spec());
|
| @@ -350,7 +344,7 @@ TEST(GURLTest, GetAsReferrer) {
|
| {"http://:@www.google.com", "http://www.google.com/"},
|
| {"http://www.google.com/temp/foo?q#b", "http://www.google.com/temp/foo?q"},
|
| };
|
| - for (size_t i = 0; i < ARRAYSIZE(cases); i++) {
|
| + for (size_t i = 0; i < arraysize(cases); i++) {
|
| GURL url(cases[i].input);
|
| GURL origin = url.GetAsReferrer();
|
| EXPECT_EQ(cases[i].expected, origin.spec());
|
| @@ -369,7 +363,7 @@ TEST(GURLTest, GetWithEmptyPath) {
|
| {"filesystem:file:///temporary/bar.html?baz=22", "filesystem:file:///temporary/"},
|
| };
|
|
|
| - for (size_t i = 0; i < ARRAYSIZE(cases); i++) {
|
| + for (size_t i = 0; i < arraysize(cases); i++) {
|
| GURL url(cases[i].input);
|
| GURL empty_path = url.GetWithEmptyPath();
|
| EXPECT_EQ(cases[i].expected, empty_path.spec());
|
| @@ -401,7 +395,7 @@ TEST(GURLTest, Replacements) {
|
| {"filesystem:http://www.google.com/foo/bar.html?foo#bar", NULL, NULL, NULL, NULL, NULL, "/", "", "", "filesystem:http://www.google.com/foo/"},
|
| };
|
|
|
| - for (size_t i = 0; i < ARRAYSIZE(replace_cases); i++) {
|
| + for (size_t i = 0; i < arraysize(replace_cases); i++) {
|
| const ReplaceCase& cur = replace_cases[i];
|
| GURL url(cur.base);
|
| GURL::Replacements repl;
|
| @@ -458,7 +452,7 @@ TEST(GURLTest, PathForRequest) {
|
| {"filesystem:http://www.google.com/temporary/foo/bar.html?query", "/foo/bar.html?query", "/temporary"},
|
| };
|
|
|
| - for (size_t i = 0; i < ARRAYSIZE(cases); i++) {
|
| + for (size_t i = 0; i < arraysize(cases); i++) {
|
| GURL url(cases[i].input);
|
| std::string path_request = url.PathForRequest();
|
| EXPECT_EQ(cases[i].expected, path_request);
|
| @@ -506,7 +500,7 @@ TEST(GURLTest, EffectiveIntPort) {
|
| {"filesystem:file:///t/foo", PORT_UNSPECIFIED},
|
| };
|
|
|
| - for (size_t i = 0; i < ARRAYSIZE(port_tests); i++) {
|
| + for (size_t i = 0; i < arraysize(port_tests); i++) {
|
| GURL url(port_tests[i].spec);
|
| EXPECT_EQ(port_tests[i].expected_int_port, url.EffectiveIntPort());
|
| }
|
| @@ -527,7 +521,7 @@ TEST(GURLTest, IPAddress) {
|
| {"some random input!", false},
|
| };
|
|
|
| - for (size_t i = 0; i < ARRAYSIZE(ip_tests); i++) {
|
| + for (size_t i = 0; i < arraysize(ip_tests); i++) {
|
| GURL url(ip_tests[i].spec);
|
| EXPECT_EQ(ip_tests[i].expected_ip, url.HostIsIPAddress());
|
| }
|
| @@ -552,7 +546,7 @@ TEST(GURLTest, HostNoBrackets) {
|
| {"http://]/", "]", "]"},
|
| {"", "", ""},
|
| };
|
| - for (size_t i = 0; i < ARRAYSIZE(cases); i++) {
|
| + for (size_t i = 0; i < arraysize(cases); i++) {
|
| GURL url(cases[i].input);
|
| EXPECT_EQ(cases[i].expected_host, url.host());
|
| EXPECT_EQ(cases[i].expected_plainhost, url.HostNoBrackets());
|
|
|