summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_content_browser_client_browsertest.cc
diff options
context:
space:
mode:
authorckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-13 17:29:15 +0000
committerckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-13 17:29:15 +0000
commit44e8addb60056d5a41e48572bee221f2ce046634 (patch)
tree86b399a2a857bb8b6ffd2f137e83c413225613bf /chrome/browser/chrome_content_browser_client_browsertest.cc
parentca23992b03a5d7f7499f251576e23d88b9821237 (diff)
downloadchromium_src-44e8addb60056d5a41e48572bee221f2ce046634.zip
chromium_src-44e8addb60056d5a41e48572bee221f2ce046634.tar.gz
chromium_src-44e8addb60056d5a41e48572bee221f2ce046634.tar.bz2
WebUI virtual URLs: Handle the case where the new host is empty
GURL parses "chrome://chrome://downloads/downloads/" as "chrome://chrome//downloads/downloads/". We shouldn't change that, but make sure it is correctly converted to a virtual URL and displayed. BUG=238110 TEST=Go to "chrome://chrome://downloads/downloads/", the address bar should show "chrome://chrome//downloads/downloads/" Review URL: https://chromiumcodereview.appspot.com/14670020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206102 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_content_browser_client_browsertest.cc')
-rw-r--r--chrome/browser/chrome_content_browser_client_browsertest.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc
index d7bfa51..a8b6bbb 100644
--- a/chrome/browser/chrome_content_browser_client_browsertest.cc
+++ b/chrome/browser/chrome_content_browser_client_browsertest.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <string>
-
#include "base/command_line.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -29,8 +27,8 @@ class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest {
IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
UberURLHandler_SettingsPage) {
- const GURL url_short(std::string("chrome://settings/"));
- const GURL url_long(std::string("chrome://chrome/settings/"));
+ const GURL url_short("chrome://settings/");
+ const GURL url_long("chrome://chrome/settings/");
ui_test_utils::NavigateToURL(browser(), url_short);
NavigationEntry* entry = GetLastCommittedEntry();
@@ -42,8 +40,8 @@ IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
UberURLHandler_ContentSettingsPage) {
- const GURL url_short(std::string("chrome://settings/content"));
- const GURL url_long(std::string("chrome://chrome/settings/content"));
+ const GURL url_short("chrome://settings/content");
+ const GURL url_long("chrome://chrome/settings/content");
ui_test_utils::NavigateToURL(browser(), url_short);
NavigationEntry* entry = GetLastCommittedEntry();
@@ -55,7 +53,7 @@ IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
UberURLHandler_AboutPage) {
- const GURL url(std::string("chrome://chrome/"));
+ const GURL url("chrome://chrome/");
ui_test_utils::NavigateToURL(browser(), url);
NavigationEntry* entry = GetLastCommittedEntry();
@@ -65,6 +63,18 @@ IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
EXPECT_EQ(url, entry->GetVirtualURL());
}
+IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
+ UberURLHandler_EmptyHost) {
+ const GURL url("chrome://chrome//foo");
+
+ ui_test_utils::NavigateToURL(browser(), url);
+ NavigationEntry* entry = GetLastCommittedEntry();
+
+ ASSERT_TRUE(entry != NULL);
+ EXPECT_TRUE(entry->GetVirtualURL().is_valid());
+ EXPECT_EQ(url, entry->GetVirtualURL());
+}
+
// Test that a basic navigation works in --site-per-process mode. This prevents
// regressions when that mode calls out into the ChromeContentBrowserClient,
// such as http://crbug.com/164223.