Chromium Code Reviews| 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 "chrome/test/base/in_process_browser_test.h" | |
| 6 #include "chrome/test/base/ui_test_utils.h" | |
| 7 #include "chrome/browser/ui/browser_tabstrip.h" | |
| 8 #include "chrome/browser/ui/tab_contents/tab_contents.h" | |
| 9 #include "content/public/browser/navigation_controller.h" | |
| 10 #include "content/public/browser/navigation_entry.h" | |
| 11 #include "content/public/browser/web_contents.h" | |
| 12 #include "googleurl/src/gurl.h" | |
| 13 | |
| 14 #include <string> | |
|
Alexei Svitkine (slow)
2012/08/10 19:13:56
This should be above the other includes.
| |
| 15 | |
| 16 using content::NavigationEntry; | |
|
Alexei Svitkine (slow)
2012/08/10 19:13:56
Put the test into the content namespace and removi
| |
| 17 | |
| 18 class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest { | |
| 19 public: | |
| 20 NavigationEntry* GetLastCommittedEntry() { | |
|
Alexei Svitkine (slow)
2012/08/10 19:13:56
Add a comment.
| |
| 21 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
| |
| 22 ->GetController().GetLastCommittedEntry(); | |
| 23 } | |
| 24 }; | |
| 25 | |
| 26 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, UberURLHandler) { | |
| 27 const GURL url1_short(std::string("chrome://settings/")); | |
| 28 const GURL url1_long(std::string("chrome://chrome/settings/")); | |
| 29 | |
| 30 const GURL url2_short(std::string("chrome://settings/content")); | |
| 31 const GURL url2_long(std::string("chrome://chrome/settings/content")); | |
| 32 | |
| 33 ui_test_utils::NavigateToURL(browser(), url1_short); | |
| 34 NavigationEntry* entry = GetLastCommittedEntry(); | |
| 35 | |
| 36 ASSERT_TRUE(entry != NULL); | |
| 37 EXPECT_EQ(url1_long, entry->GetURL()); | |
| 38 EXPECT_EQ(url1_short, entry->GetVirtualURL()); | |
| 39 | |
| 40 ui_test_utils::NavigateToURL(browser(), url2_short); | |
| 41 entry = GetLastCommittedEntry(); | |
| 42 | |
| 43 ASSERT_TRUE(entry != NULL); | |
| 44 EXPECT_EQ(url2_long, entry->GetURL()); | |
| 45 EXPECT_EQ(url2_short, entry->GetVirtualURL()); | |
| 46 } | |
| OLD | NEW |