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

Side by Side 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: bugfix, style fix Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <string>
6
7 #include "chrome/test/base/in_process_browser_test.h"
8 #include "chrome/test/base/ui_test_utils.h"
9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents.h"
11 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/web_contents.h"
14 #include "googleurl/src/gurl.h"
15
16 namespace content {
17
18 class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest {
19 public:
20 // Returns the last committed navigation entry of the first tab. May be NULL
21 // if there is no such entry.
22 NavigationEntry* GetLastCommittedEntry() {
23 return chrome::GetTabContentsAt(browser(), 0)->web_contents()
24 ->GetController().GetLastCommittedEntry();
25 }
26 };
27
28 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, UberURLHandler) {
29 const GURL url1_short(std::string("chrome://settings/"));
30 const GURL url1_long(std::string("chrome://chrome/settings/"));
31
32 const GURL url2_short(std::string("chrome://settings/content"));
33 const GURL url2_long(std::string("chrome://chrome/settings/content"));
34
35 ui_test_utils::NavigateToURL(browser(), url1_short);
36 NavigationEntry* entry = GetLastCommittedEntry();
37
38 ASSERT_TRUE(entry != NULL);
39 EXPECT_EQ(url1_long, entry->GetURL());
40 EXPECT_EQ(url1_short, entry->GetVirtualURL());
41
42 ui_test_utils::NavigateToURL(browser(), url2_short);
43 entry = GetLastCommittedEntry();
44
45 ASSERT_TRUE(entry != NULL);
46 EXPECT_EQ(url2_long, entry->GetURL());
47 EXPECT_EQ(url2_short, entry->GetVirtualURL());
48 }
49
50 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698