| 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/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" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 const GURL bookmarks_url(chrome::kChromeUIBookmarksURL); | 104 const GURL bookmarks_url(chrome::kChromeUIBookmarksURL); |
| 105 ui_test_utils::NavigateToURL(browser(), bookmarks_url); | 105 ui_test_utils::NavigateToURL(browser(), bookmarks_url); |
| 106 // The default chrome://bookmarks implementation will append /#1 to the URL | 106 // The default chrome://bookmarks implementation will append /#1 to the URL |
| 107 // once loaded. Use |GetWithEmptyPath()| to avoid flakyness. | 107 // once loaded. Use |GetWithEmptyPath()| to avoid flakyness. |
| 108 EXPECT_EQ(bookmarks_url, GetLocationBarTextAsURL().GetWithEmptyPath()); | 108 EXPECT_EQ(bookmarks_url, GetLocationBarTextAsURL().GetWithEmptyPath()); |
| 109 NavigationEntry* navigation = GetNavigationEntry(); | 109 NavigationEntry* navigation = GetNavigationEntry(); |
| 110 EXPECT_EQ(bookmarks_url, navigation->GetVirtualURL().GetWithEmptyPath()); | 110 EXPECT_EQ(bookmarks_url, navigation->GetVirtualURL().GetWithEmptyPath()); |
| 111 EXPECT_TRUE(navigation->GetURL().SchemeIs(extensions::kExtensionScheme)); | 111 EXPECT_TRUE(navigation->GetURL().SchemeIs(extensions::kExtensionScheme)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 #if defined(FILE_MANAGER_EXTENSION) | |
| 115 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, FileManagerURL) { | |
| 116 // Navigate to chrome://files and check that the location bar URL is | |
| 117 // what was entered and the internal URL uses the chrome-extension:// scheme. | |
| 118 TestExtensionURLOverride(GURL(chrome::kChromeUIFileManagerURL)); | |
| 119 } | |
| 120 #endif | |
| 121 | |
| 122 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLWithRef) { | 114 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLWithRef) { |
| 123 // Navigate to chrome://bookmarks/#1 and check that the location bar URL is | 115 // Navigate to chrome://bookmarks/#1 and check that the location bar URL is |
| 124 // what was entered and the internal URL uses the chrome-extension:// scheme. | 116 // what was entered and the internal URL uses the chrome-extension:// scheme. |
| 125 GURL url_with_ref(chrome::kChromeUIBookmarksURL + std::string("#1")); | 117 GURL url_with_ref(chrome::kChromeUIBookmarksURL + std::string("#1")); |
| 126 TestExtensionURLOverride(url_with_ref); | 118 TestExtensionURLOverride(url_with_ref); |
| 127 } | 119 } |
| 128 | 120 |
| 129 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { | 121 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { |
| 130 // Load an extension that overrides chrome://bookmarks. | 122 // Load an extension that overrides chrome://bookmarks. |
| 131 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("bookmarks"))); | 123 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("bookmarks"))); |
| 132 // Navigate to chrome://bookmarks and check that the location bar URL is what | 124 // Navigate to chrome://bookmarks and check that the location bar URL is what |
| 133 // was entered and the internal URL uses the chrome-extension:// scheme. | 125 // was entered and the internal URL uses the chrome-extension:// scheme. |
| 134 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); | 126 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); |
| 135 } | 127 } |
| OLD | NEW |