OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/browser_navigator_browsertest.h" | 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 // Converts long uber URLs ("chrome://chrome/foo/") to short (virtual) URLs | 63 // Converts long uber URLs ("chrome://chrome/foo/") to short (virtual) URLs |
64 // ("chrome://foo/"). This should be used to convert the return value of | 64 // ("chrome://foo/"). This should be used to convert the return value of |
65 // WebContentsImpl::GetURL before comparison because it can return either the | 65 // WebContentsImpl::GetURL before comparison because it can return either the |
66 // real URL or the virtual URL. | 66 // real URL or the virtual URL. |
67 GURL ShortenUberURL(const GURL& url) { | 67 GURL ShortenUberURL(const GURL& url) { |
68 std::string url_string = url.spec(); | 68 std::string url_string = url.spec(); |
69 const std::string long_prefix = "chrome://chrome/"; | 69 const std::string long_prefix = "chrome://chrome/"; |
70 const std::string short_prefix = "chrome://"; | 70 const std::string short_prefix = "chrome://"; |
71 if (!base::StartsWith(url_string, long_prefix, base::CompareCase::SENSITIVE)) | 71 if (url_string.find(long_prefix) != 0) |
72 return url; | 72 return url; |
73 url_string.replace(0, long_prefix.length(), short_prefix); | 73 url_string.replace(0, long_prefix.length(), short_prefix); |
74 return GURL(url_string); | 74 return GURL(url_string); |
75 } | 75 } |
76 | 76 |
77 } // namespace | 77 } // namespace |
78 | 78 |
79 chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams() const { | 79 chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams() const { |
80 return MakeNavigateParams(browser()); | 80 return MakeNavigateParams(browser()); |
81 } | 81 } |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 EXPECT_EQ(expected_title, params.target_contents->GetTitle()); | 1443 EXPECT_EQ(expected_title, params.target_contents->GetTitle()); |
1444 // GURL always keeps non-ASCII characters escaped, but check them anyways. | 1444 // GURL always keeps non-ASCII characters escaped, but check them anyways. |
1445 EXPECT_EQ(GURL(expected_url).spec(), params.target_contents->GetURL().spec()); | 1445 EXPECT_EQ(GURL(expected_url).spec(), params.target_contents->GetURL().spec()); |
1446 // Check the omnibox text. It should have escaped RTL with unescaped text. | 1446 // Check the omnibox text. It should have escaped RTL with unescaped text. |
1447 LocationBar* location_bar = browser()->window()->GetLocationBar(); | 1447 LocationBar* location_bar = browser()->window()->GetLocationBar(); |
1448 OmniboxView* omnibox_view = location_bar->GetOmniboxView(); | 1448 OmniboxView* omnibox_view = location_bar->GetOmniboxView(); |
1449 EXPECT_EQ(base::UTF8ToUTF16(expected_url), omnibox_view->GetText()); | 1449 EXPECT_EQ(base::UTF8ToUTF16(expected_url), omnibox_view->GetText()); |
1450 } | 1450 } |
1451 | 1451 |
1452 } // namespace | 1452 } // namespace |
OLD | NEW |