| 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 "components/url_formatter/elide_url.h" | 5 #include "components/url_formatter/elide_url.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 "reallyreallyreallylongdomainname.com"}, | 189 "reallyreallyreallylongdomainname.com"}, |
| 190 {"http://a.b.c.d.e.f.com", kEllipsisStr + "f.com", | 190 {"http://a.b.c.d.e.f.com", kEllipsisStr + "f.com", |
| 191 Testcase::NO_IOS9_OR_LATER}, | 191 Testcase::NO_IOS9_OR_LATER}, |
| 192 {"http://foo", "foo"}, | 192 {"http://foo", "foo"}, |
| 193 {"http://foo.bar", "foo.bar"}, | 193 {"http://foo.bar", "foo.bar"}, |
| 194 {"http://subdomain.foo.bar", kEllipsisStr + "in.foo.bar", | 194 {"http://subdomain.foo.bar", kEllipsisStr + "in.foo.bar", |
| 195 Testcase::NO_IOS9_OR_LATER}, | 195 Testcase::NO_IOS9_OR_LATER}, |
| 196 {"http://subdomain.reallylongdomainname.com", | 196 {"http://subdomain.reallylongdomainname.com", |
| 197 kEllipsisStr + "ain.reallylongdomainname.com", Testcase::NO_IOS}, | 197 kEllipsisStr + "ain.reallylongdomainname.com", Testcase::NO_IOS}, |
| 198 {"http://a.b.c.d.e.f.com", kEllipsisStr + ".e.f.com", Testcase::NO_IOS}, | 198 {"http://a.b.c.d.e.f.com", kEllipsisStr + ".e.f.com", Testcase::NO_IOS}, |
| 199 // IDN - Greek alpha.beta.gamma.delta.epsilon.zeta.com |
| 200 {"http://xn--mxa.xn--nxa.xn--oxa.xn--pxa.xn--qxa.xn--rxa.com", |
| 201 kEllipsisStr + ".\xCE\xB5.\xCE\xB6.com", Testcase::NO_IOS}, |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 for (size_t i = 0; i < arraysize(testcases); ++i) { | 204 for (size_t i = 0; i < arraysize(testcases); ++i) { |
| 202 #if defined(OS_IOS) | 205 #if defined(OS_IOS) |
| 203 if (testcases[i].platforms == Testcase::NO_IOS || | 206 if (testcases[i].platforms == Testcase::NO_IOS || |
| 204 (testcases[i].platforms == Testcase::NO_IOS9_OR_LATER && | 207 (testcases[i].platforms == Testcase::NO_IOS9_OR_LATER && |
| 205 base::ios::IsRunningOnIOS9OrLater())) { | 208 base::ios::IsRunningOnIOS9OrLater())) { |
| 206 continue; | 209 continue; |
| 207 } | 210 } |
| 208 #endif | 211 #endif |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 EXPECT_EQ(base::string16(), formatted) | 345 EXPECT_EQ(base::string16(), formatted) |
| 343 << "Explicitly test the 0-argument GURL constructor"; | 346 << "Explicitly test the 0-argument GURL constructor"; |
| 344 | 347 |
| 345 base::string16 formatted_omit_scheme = | 348 base::string16 formatted_omit_scheme = |
| 346 url_formatter::FormatUrlForSecurityDisplayOmitScheme(GURL()); | 349 url_formatter::FormatUrlForSecurityDisplayOmitScheme(GURL()); |
| 347 EXPECT_EQ(base::string16(), formatted_omit_scheme) | 350 EXPECT_EQ(base::string16(), formatted_omit_scheme) |
| 348 << "Explicitly test the 0-argument GURL constructor"; | 351 << "Explicitly test the 0-argument GURL constructor"; |
| 349 } | 352 } |
| 350 | 353 |
| 351 } // namespace | 354 } // namespace |
| OLD | NEW |