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

Side by Side Diff: chrome/browser/extensions/extension_url_rewrite_browsertest.cc

Issue 8956059: Rename NavigationController to NavigationControllerImpl and put it into the content namespace. Al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process_util.h" 5 #include "base/process_util.h"
6 #include "base/sys_string_conversions.h" 6 #include "base/sys_string_conversions.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/omnibox/location_bar.h" 11 #include "chrome/browser/ui/omnibox/location_bar.h"
12 #include "chrome/browser/ui/omnibox/omnibox_view.h" 12 #include "chrome/browser/ui/omnibox/omnibox_view.h"
13 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
16 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
17 #include "content/browser/tab_contents/navigation_controller.h" 17 #include "content/browser/tab_contents/navigation_controller.h"
18 #include "content/browser/tab_contents/tab_contents.h" 18 #include "content/browser/tab_contents/tab_contents.h"
19 #include "content/public/browser/navigation_entry.h" 19 #include "content/public/browser/navigation_entry.h"
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 21
22 using content::NavigationEntry;
23
22 class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest { 24 class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest {
23 protected: 25 protected:
24 std::string GetLocationBarText() const { 26 std::string GetLocationBarText() const {
25 return UTF16ToUTF8( 27 return UTF16ToUTF8(
26 browser()->window()->GetLocationBar()->location_entry()->GetText()); 28 browser()->window()->GetLocationBar()->location_entry()->GetText());
27 } 29 }
28 30
29 GURL GetLocationBarTextAsURL() const { 31 GURL GetLocationBarTextAsURL() const {
30 return GURL(GetLocationBarText()); 32 return GURL(GetLocationBarText());
31 } 33 }
32 34
33 NavigationController* GetNavigationController() const { 35 NavigationController* GetNavigationController() const {
34 return &browser()->GetSelectedTabContents()->GetController(); 36 return &browser()->GetSelectedTabContents()->GetController();
35 } 37 }
36 38
37 content::NavigationEntry* GetNavigationEntry() const { 39 NavigationEntry* GetNavigationEntry() const {
38 return GetNavigationController()->GetActiveEntry(); 40 return GetNavigationController()->GetActiveEntry();
39 } 41 }
40 42
41 FilePath GetTestExtensionPath(const char* extension_name) const { 43 FilePath GetTestExtensionPath(const char* extension_name) const {
42 return test_data_dir_.AppendASCII("browsertest/url_rewrite/"). 44 return test_data_dir_.AppendASCII("browsertest/url_rewrite/").
43 AppendASCII(extension_name); 45 AppendASCII(extension_name);
44 } 46 }
45 47
46 // Navigates to |url| and tests that the location bar and the |virtual_url| 48 // Navigates to |url| and tests that the location bar and the |virtual_url|
47 // correspond to |url|, while the real URL of the navigation entry uses the 49 // correspond to |url|, while the real URL of the navigation entry uses the
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 TestExtensionURLOverride(url_with_ref); 103 TestExtensionURLOverride(url_with_ref);
102 } 104 }
103 105
104 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { 106 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) {
105 // Load an extension that overrides chrome://bookmarks. 107 // Load an extension that overrides chrome://bookmarks.
106 LoadExtension(GetTestExtensionPath("bookmarks")); 108 LoadExtension(GetTestExtensionPath("bookmarks"));
107 // Navigate to chrome://bookmarks and check that the location bar URL is what 109 // Navigate to chrome://bookmarks and check that the location bar URL is what
108 // was entered and the internal URL uses the chrome-extension:// scheme. 110 // was entered and the internal URL uses the chrome-extension:// scheme.
109 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); 111 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL));
110 } 112 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tabs_module.cc ('k') | chrome/browser/external_tab_container_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698