| 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/strings/sys_string_conversions.h" | 5 #include "base/strings/sys_string_conversions.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/extensions/component_loader.h" | 7 #include "chrome/browser/extensions/component_loader.h" |
| 8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, NewTabPageURLOverride) { | 86 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, NewTabPageURLOverride) { |
| 87 // Load an extension to override the NTP and check that the location bar text | 87 // Load an extension to override the NTP and check that the location bar text |
| 88 // is blank after navigating to chrome://newtab. | 88 // is blank after navigating to chrome://newtab. |
| 89 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("newtab"))); | 89 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("newtab"))); |
| 90 TestURLNotShown(GURL(chrome::kChromeUINewTabURL)); | 90 TestURLNotShown(GURL(chrome::kChromeUINewTabURL)); |
| 91 // Check that the internal URL uses the chrome-extension:// scheme. | 91 // Check that the internal URL uses the chrome-extension:// scheme. |
| 92 EXPECT_TRUE(GetNavigationEntry()->GetURL().SchemeIs( | 92 EXPECT_TRUE(GetNavigationEntry()->GetURL().SchemeIs( |
| 93 extensions::kExtensionScheme)); | 93 extensions::kExtensionScheme)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // TODO(linux_aura) http://crbug.com/163931 | 96 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURL) { |
| 97 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | |
| 98 #define MAYBE_BookmarksURL DISABLED_BookmarksURL | |
| 99 #else | |
| 100 #define MAYBE_BookmarksURL BookmarksURL | |
| 101 #endif | |
| 102 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, MAYBE_BookmarksURL) { | |
| 103 // Navigate to chrome://bookmarks and check that the location bar URL is | 97 // Navigate to chrome://bookmarks and check that the location bar URL is |
| 104 // what was entered and the internal URL uses the chrome-extension:// scheme. | 98 // what was entered and the internal URL uses the chrome-extension:// scheme. |
| 105 const GURL bookmarks_url(chrome::kChromeUIBookmarksURL); | 99 const GURL bookmarks_url(chrome::kChromeUIBookmarksURL); |
| 106 ui_test_utils::NavigateToURL(browser(), bookmarks_url); | 100 ui_test_utils::NavigateToURL(browser(), bookmarks_url); |
| 107 // The default chrome://bookmarks implementation will append /#1 to the URL | 101 // The default chrome://bookmarks implementation will append /#1 to the URL |
| 108 // once loaded. Use |GetWithEmptyPath()| to avoid flakyness. | 102 // once loaded. Use |GetWithEmptyPath()| to avoid flakyness. |
| 109 EXPECT_EQ(bookmarks_url, GetLocationBarTextAsURL().GetWithEmptyPath()); | 103 EXPECT_EQ(bookmarks_url, GetLocationBarTextAsURL().GetWithEmptyPath()); |
| 110 NavigationEntry* navigation = GetNavigationEntry(); | 104 NavigationEntry* navigation = GetNavigationEntry(); |
| 111 EXPECT_EQ(bookmarks_url, navigation->GetVirtualURL().GetWithEmptyPath()); | 105 EXPECT_EQ(bookmarks_url, navigation->GetVirtualURL().GetWithEmptyPath()); |
| 112 EXPECT_TRUE(navigation->GetURL().SchemeIs(extensions::kExtensionScheme)); | 106 EXPECT_TRUE(navigation->GetURL().SchemeIs(extensions::kExtensionScheme)); |
| 113 } | 107 } |
| 114 | 108 |
| 115 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLWithRef) { | 109 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLWithRef) { |
| 116 // Navigate to chrome://bookmarks/#1 and check that the location bar URL is | 110 // Navigate to chrome://bookmarks/#1 and check that the location bar URL is |
| 117 // what was entered and the internal URL uses the chrome-extension:// scheme. | 111 // what was entered and the internal URL uses the chrome-extension:// scheme. |
| 118 GURL url_with_ref(chrome::kChromeUIBookmarksURL + std::string("#1")); | 112 GURL url_with_ref(chrome::kChromeUIBookmarksURL + std::string("#1")); |
| 119 TestExtensionURLOverride(url_with_ref); | 113 TestExtensionURLOverride(url_with_ref); |
| 120 } | 114 } |
| 121 | 115 |
| 122 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { | 116 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { |
| 123 // Load an extension that overrides chrome://bookmarks. | 117 // Load an extension that overrides chrome://bookmarks. |
| 124 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("bookmarks"))); | 118 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("bookmarks"))); |
| 125 // 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 |
| 126 // was entered and the internal URL uses the chrome-extension:// scheme. | 120 // was entered and the internal URL uses the chrome-extension:// scheme. |
| 127 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); | 121 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); |
| 128 } | 122 } |
| OLD | NEW |