| OLD | NEW |
| 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/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_tabstrip.h" | 11 #include "chrome/browser/ui/browser_tabstrip.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/omnibox/location_bar.h" | 13 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 13 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 14 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 17 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
| 18 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
| 19 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
| 20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 21 #include "extensions/common/constants.h" | 22 #include "extensions/common/constants.h" |
| 22 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
| 23 | 24 |
| 24 using content::NavigationEntry; | 25 using content::NavigationEntry; |
| 25 | 26 |
| 26 class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest { | 27 class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest { |
| 28 public: |
| 29 virtual void SetUp() OVERRIDE { |
| 30 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); |
| 31 ExtensionBrowserTest::SetUp(); |
| 32 } |
| 33 |
| 27 protected: | 34 protected: |
| 28 std::string GetLocationBarText() const { | 35 std::string GetLocationBarText() const { |
| 29 return UTF16ToUTF8( | 36 return UTF16ToUTF8( |
| 30 browser()->window()->GetLocationBar()->GetLocationEntry()->GetText()); | 37 browser()->window()->GetLocationBar()->GetLocationEntry()->GetText()); |
| 31 } | 38 } |
| 32 | 39 |
| 33 GURL GetLocationBarTextAsURL() const { | 40 GURL GetLocationBarTextAsURL() const { |
| 34 return GURL(GetLocationBarText()); | 41 return GURL(GetLocationBarText()); |
| 35 } | 42 } |
| 36 | 43 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 TestExtensionURLOverride(url_with_ref); | 113 TestExtensionURLOverride(url_with_ref); |
| 107 } | 114 } |
| 108 | 115 |
| 109 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { | 116 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { |
| 110 // Load an extension that overrides chrome://bookmarks. | 117 // Load an extension that overrides chrome://bookmarks. |
| 111 LoadExtension(GetTestExtensionPath("bookmarks")); | 118 LoadExtension(GetTestExtensionPath("bookmarks")); |
| 112 // Navigate to chrome://bookmarks and check that the location bar URL is what | 119 // Navigate to chrome://bookmarks and check that the location bar URL is what |
| 113 // was entered and the internal URL uses the chrome-extension:// scheme. | 120 // was entered and the internal URL uses the chrome-extension:// scheme. |
| 114 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); | 121 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); |
| 115 } | 122 } |
| OLD | NEW |