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

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

Issue 12066003: Remove TabStripModel wrapper use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gtk Created 7 years, 10 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) 2012 The Chromium Authors. All rights reserved. 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 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/component_loader.h" 8 #include "chrome/browser/extensions/component_loader.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_tabstrip.h"
12 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/omnibox/location_bar.h" 12 #include "chrome/browser/ui/omnibox/location_bar.h"
14 #include "chrome/browser/ui/omnibox/omnibox_view.h" 13 #include "chrome/browser/ui/omnibox/omnibox_view.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
18 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/navigation_controller.h" 19 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/navigation_entry.h" 20 #include "content/public/browser/navigation_entry.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "extensions/common/constants.h" 22 #include "extensions/common/constants.h"
23 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
24 24
(...skipping 10 matching lines...) Expand all
35 std::string GetLocationBarText() const { 35 std::string GetLocationBarText() const {
36 return UTF16ToUTF8( 36 return UTF16ToUTF8(
37 browser()->window()->GetLocationBar()->GetLocationEntry()->GetText()); 37 browser()->window()->GetLocationBar()->GetLocationEntry()->GetText());
38 } 38 }
39 39
40 GURL GetLocationBarTextAsURL() const { 40 GURL GetLocationBarTextAsURL() const {
41 return GURL(GetLocationBarText()); 41 return GURL(GetLocationBarText());
42 } 42 }
43 43
44 content::NavigationController* GetNavigationController() const { 44 content::NavigationController* GetNavigationController() const {
45 return &chrome::GetActiveWebContents(browser())->GetController(); 45 return &browser()->tab_strip_model()->GetActiveWebContents()->
46 GetController();
46 } 47 }
47 48
48 NavigationEntry* GetNavigationEntry() const { 49 NavigationEntry* GetNavigationEntry() const {
49 return GetNavigationController()->GetActiveEntry(); 50 return GetNavigationController()->GetActiveEntry();
50 } 51 }
51 52
52 FilePath GetTestExtensionPath(const char* extension_name) const { 53 FilePath GetTestExtensionPath(const char* extension_name) const {
53 return test_data_dir_.AppendASCII("browsertest/url_rewrite/"). 54 return test_data_dir_.AppendASCII("browsertest/url_rewrite/").
54 AppendASCII(extension_name); 55 AppendASCII(extension_name);
55 } 56 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 TestExtensionURLOverride(url_with_ref); 114 TestExtensionURLOverride(url_with_ref);
114 } 115 }
115 116
116 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { 117 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) {
117 // Load an extension that overrides chrome://bookmarks. 118 // Load an extension that overrides chrome://bookmarks.
118 LoadExtension(GetTestExtensionPath("bookmarks")); 119 LoadExtension(GetTestExtensionPath("bookmarks"));
119 // Navigate to chrome://bookmarks and check that the location bar URL is what 120 // Navigate to chrome://bookmarks and check that the location bar URL is what
120 // was entered and the internal URL uses the chrome-extension:// scheme. 121 // was entered and the internal URL uses the chrome-extension:// scheme.
121 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); 122 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL));
122 } 123 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_startup_browsertest.cc ('k') | chrome/browser/extensions/page_action_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698