Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: chrome/browser/chrome_content_browser_client_browsertest.cc

Issue 10780013: Add reverse URL handler for shortening uber URLs (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: browser test Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client_browsertest.cc
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 0000000000000000000000000000000000000000..f46abd563c53ee31e26f5c7f2139319aba0b4bdb
--- /dev/null
+++ b/chrome/browser/chrome_content_browser_client_browsertest.cc
@@ -0,0 +1,46 @@
+// 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 "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"
+
+#include <string>
Alexei Svitkine (slow) 2012/08/10 19:13:56 This should be above the other includes.
+
+using content::NavigationEntry;
Alexei Svitkine (slow) 2012/08/10 19:13:56 Put the test into the content namespace and removi
+
+class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest {
+ public:
+ NavigationEntry* GetLastCommittedEntry() {
Alexei Svitkine (slow) 2012/08/10 19:13:56 Add a comment.
+ return chrome::GetTabContentsAt(browser(), 0)->web_contents()
Alexei Svitkine (slow) 2012/08/10 19:13:56 Is there a guarantee that nothing in the deref cha
Cem Kocagil 2012/08/11 16:41:30 Before and after we navigate there should be one t
+ ->GetController().GetLastCommittedEntry();
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, UberURLHandler) {
+ const GURL url1_short(std::string("chrome://settings/"));
+ const GURL url1_long(std::string("chrome://chrome/settings/"));
+
+ const GURL url2_short(std::string("chrome://settings/content"));
+ const GURL url2_long(std::string("chrome://chrome/settings/content"));
+
+ ui_test_utils::NavigateToURL(browser(), url1_short);
+ NavigationEntry* entry = GetLastCommittedEntry();
+
+ ASSERT_TRUE(entry != NULL);
+ EXPECT_EQ(url1_long, entry->GetURL());
+ EXPECT_EQ(url1_short, entry->GetVirtualURL());
+
+ ui_test_utils::NavigateToURL(browser(), url2_short);
+ entry = GetLastCommittedEntry();
+
+ ASSERT_TRUE(entry != NULL);
+ EXPECT_EQ(url2_long, entry->GetURL());
+ EXPECT_EQ(url2_short, entry->GetVirtualURL());
+}
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698