summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_content_browser_client_browsertest.cc
diff options
context:
space:
mode:
authorcem.kocagil@gmail.com <cem.kocagil@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-25 03:06:24 +0000
committercem.kocagil@gmail.com <cem.kocagil@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-25 03:06:24 +0000
commitf8f93eb2f80a882e6d46c2e69d6da5b693ca388c (patch)
tree301d221fd085789979265b92a4070f04f2311959 /chrome/browser/chrome_content_browser_client_browsertest.cc
parent7d5f2285f300d2b40f4c1fe6a20a399af0e9da28 (diff)
downloadchromium_src-f8f93eb2f80a882e6d46c2e69d6da5b693ca388c.zip
chromium_src-f8f93eb2f80a882e6d46c2e69d6da5b693ca388c.tar.gz
chromium_src-f8f93eb2f80a882e6d46c2e69d6da5b693ca388c.tar.bz2
Second try of 157576 https://chromiumcodereview.appspot.com/10780013/
Add reverse URL handler for shortening uber URLs BUG=120493 TEST=Open the settings page. The address bar should show "chrome://settings". Click the "extensions" button on the left. The address bar should show "chrome://extensions". Click the "settings" button on the left, "show advanced settings", "content settings". The address bar should show "chrome://settings/content". Review URL: https://chromiumcodereview.appspot.com/10941050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158504 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.cc54
1 files changed, 54 insertions, 0 deletions
diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc
new file mode 100644
index 0000000..171d4f6
--- /dev/null
+++ b/chrome/browser/chrome_content_browser_client_browsertest.cc
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 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 <string>
+
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "content/public/browser/navigation_controller.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/web_contents.h"
+#include "googleurl/src/gurl.h"
+
+namespace content {
+
+class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest {
+ public:
+ // Returns the last committed navigation entry of the first tab. May be NULL
+ // if there is no such entry.
+ NavigationEntry* GetLastCommittedEntry() {
+ return chrome::GetTabContentsAt(browser(), 0)->web_contents()
+ ->GetController().GetLastCommittedEntry();
+ }
+};
+
+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/"));
+
+ ui_test_utils::NavigateToURL(browser(), url_short);
+ NavigationEntry* entry = GetLastCommittedEntry();
+
+ ASSERT_TRUE(entry != NULL);
+ EXPECT_EQ(url_long, entry->GetURL());
+ EXPECT_EQ(url_short, entry->GetVirtualURL());
+}
+
+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"));
+
+ ui_test_utils::NavigateToURL(browser(), url_short);
+ NavigationEntry* entry = GetLastCommittedEntry();
+
+ ASSERT_TRUE(entry != NULL);
+ EXPECT_EQ(url_long, entry->GetURL());
+ EXPECT_EQ(url_short, entry->GetVirtualURL());
+}
+
+} // namespace content