| OLD | NEW |
| (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, |
| 29 UberURLHandler_SettingsPage) { |
| 30 const GURL url_short(std::string("chrome://settings/")); |
| 31 const GURL url_long(std::string("chrome://chrome/settings/")); |
| 32 |
| 33 ui_test_utils::NavigateToURL(browser(), url_short); |
| 34 NavigationEntry* entry = GetLastCommittedEntry(); |
| 35 |
| 36 ASSERT_TRUE(entry != NULL); |
| 37 EXPECT_EQ(url_long, entry->GetURL()); |
| 38 EXPECT_EQ(url_short, entry->GetVirtualURL()); |
| 39 } |
| 40 |
| 41 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, |
| 42 UberURLHandler_ContentSettingsPage) { |
| 43 const GURL url_short(std::string("chrome://settings/content")); |
| 44 const GURL url_long(std::string("chrome://chrome/settings/content")); |
| 45 |
| 46 ui_test_utils::NavigateToURL(browser(), url_short); |
| 47 NavigationEntry* entry = GetLastCommittedEntry(); |
| 48 |
| 49 ASSERT_TRUE(entry != NULL); |
| 50 EXPECT_EQ(url_long, entry->GetURL()); |
| 51 EXPECT_EQ(url_short, entry->GetVirtualURL()); |
| 52 } |
| 53 |
| 54 } // namespace content |
| OLD | NEW |