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

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

Issue 2924383003: [MD Bookmarks] Enable by default. (Closed)
Patch Set: address comments Created 3 years, 6 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
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/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"
11 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/location_bar/location_bar.h" 12 #include "chrome/browser/ui/location_bar/location_bar.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.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 "components/omnibox/browser/omnibox_view.h" 19 #include "components/omnibox/browser/omnibox_view.h"
19 #include "content/public/browser/navigation_controller.h" 20 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/navigation_entry.h" 21 #include "content/public/browser/navigation_entry.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "extensions/common/constants.h" 23 #include "extensions/common/constants.h"
23 #include "url/gurl.h" 24 #include "url/gurl.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Load an extension to override the NTP and check that the location bar text 88 // Load an extension to override the NTP and check that the location bar text
88 // is blank after navigating to chrome://newtab. 89 // is blank after navigating to chrome://newtab.
89 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("newtab"))); 90 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("newtab")));
90 TestURLNotShown(GURL(chrome::kChromeUINewTabURL)); 91 TestURLNotShown(GURL(chrome::kChromeUINewTabURL));
91 // Check that the internal URL uses the chrome-extension:// scheme. 92 // Check that the internal URL uses the chrome-extension:// scheme.
92 EXPECT_TRUE(GetNavigationEntry()->GetURL().SchemeIs( 93 EXPECT_TRUE(GetNavigationEntry()->GetURL().SchemeIs(
93 extensions::kExtensionScheme)); 94 extensions::kExtensionScheme));
94 } 95 }
95 96
96 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURL) { 97 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURL) {
98 if (MdBookmarksUI::IsEnabled())
99 return;
100
97 // Navigate to chrome://bookmarks and check that the location bar URL is 101 // Navigate to chrome://bookmarks and check that the location bar URL is
98 // what was entered and the internal URL uses the chrome-extension:// scheme. 102 // what was entered and the internal URL uses the chrome-extension:// scheme.
99 const GURL bookmarks_url(chrome::kChromeUIBookmarksURL); 103 const GURL bookmarks_url(chrome::kChromeUIBookmarksURL);
100 ui_test_utils::NavigateToURL(browser(), bookmarks_url); 104 ui_test_utils::NavigateToURL(browser(), bookmarks_url);
101 // The default chrome://bookmarks implementation will append /#1 to the URL 105 // The default chrome://bookmarks implementation will append /#1 to the URL
102 // once loaded. Use |GetWithEmptyPath()| to avoid flakyness. 106 // once loaded. Use |GetWithEmptyPath()| to avoid flakyness.
103 EXPECT_EQ(bookmarks_url, GetLocationBarTextAsURL().GetWithEmptyPath()); 107 EXPECT_EQ(bookmarks_url, GetLocationBarTextAsURL().GetWithEmptyPath());
104 NavigationEntry* navigation = GetNavigationEntry(); 108 NavigationEntry* navigation = GetNavigationEntry();
105 EXPECT_EQ(bookmarks_url, navigation->GetVirtualURL().GetWithEmptyPath()); 109 EXPECT_EQ(bookmarks_url, navigation->GetVirtualURL().GetWithEmptyPath());
106 EXPECT_TRUE(navigation->GetURL().SchemeIs(extensions::kExtensionScheme)); 110 EXPECT_TRUE(navigation->GetURL().SchemeIs(extensions::kExtensionScheme));
107 } 111 }
108 112
109 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLWithRef) { 113 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLWithRef) {
114 if (MdBookmarksUI::IsEnabled())
115 return;
116
110 // Navigate to chrome://bookmarks/#1 and check that the location bar URL is 117 // Navigate to chrome://bookmarks/#1 and check that the location bar URL is
111 // what was entered and the internal URL uses the chrome-extension:// scheme. 118 // what was entered and the internal URL uses the chrome-extension:// scheme.
112 GURL url_with_ref(chrome::kChromeUIBookmarksURL + std::string("#1")); 119 GURL url_with_ref(chrome::kChromeUIBookmarksURL + std::string("#1"));
113 TestExtensionURLOverride(url_with_ref); 120 TestExtensionURLOverride(url_with_ref);
114 } 121 }
115 122
116 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { 123 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) {
117 // Load an extension that overrides chrome://bookmarks. 124 // Load an extension that overrides chrome://bookmarks.
118 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("bookmarks"))); 125 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("bookmarks")));
119 // Navigate to chrome://bookmarks and check that the location bar URL is what 126 // 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. 127 // was entered and the internal URL uses the chrome-extension:// scheme.
121 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); 128 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL));
122 } 129 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/component_loader_unittest.cc ('k') | chrome/browser/extensions/view_extension_source_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698