| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // |virtual_url| is the same as |url|. | 69 // |virtual_url| is the same as |url|. |
| 70 void TestURLNotShown(const GURL& url) { | 70 void TestURLNotShown(const GURL& url) { |
| 71 ui_test_utils::NavigateToURL(browser(), url); | 71 ui_test_utils::NavigateToURL(browser(), url); |
| 72 EXPECT_EQ("", GetLocationBarText()); | 72 EXPECT_EQ("", GetLocationBarText()); |
| 73 EXPECT_EQ(url, GetNavigationEntry()->GetVirtualURL()); | 73 EXPECT_EQ(url, GetNavigationEntry()->GetVirtualURL()); |
| 74 } | 74 } |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, NewTabPageURL) { | 77 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, NewTabPageURL) { |
| 78 // Navigate to chrome://newtab and check that the location bar text is blank. | 78 // Navigate to chrome://newtab and check that the location bar text is blank. |
| 79 GURL url(chrome::kChromeUINewTabURL); | 79 GURL url(chrome::kChromeSearchLocalNtpUrl); |
| 80 TestURLNotShown(url); | 80 TestURLNotShown(url); |
| 81 // Check that the actual URL corresponds to chrome://newtab. | 81 // Check that the actual URL corresponds to chrome://newtab. |
| 82 EXPECT_EQ(url, GetNavigationEntry()->GetURL()); | 82 EXPECT_EQ(url, GetNavigationEntry()->GetURL()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, NewTabPageURLOverride) { | 85 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, NewTabPageURLOverride) { |
| 86 // Load an extension to override the NTP and check that the location bar text | 86 // Load an extension to override the NTP and check that the location bar text |
| 87 // is blank after navigating to chrome://newtab. | 87 // is blank after navigating to chrome://newtab. |
| 88 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("newtab"))); | 88 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("newtab"))); |
| 89 TestURLNotShown(GURL(chrome::kChromeUINewTabURL)); | 89 TestURLNotShown(GURL(chrome::kChromeUINewTabURL)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 TestExtensionURLOverride(url_with_ref); | 126 TestExtensionURLOverride(url_with_ref); |
| 127 } | 127 } |
| 128 | 128 |
| 129 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { | 129 IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURLOverride) { |
| 130 // Load an extension that overrides chrome://bookmarks. | 130 // Load an extension that overrides chrome://bookmarks. |
| 131 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("bookmarks"))); | 131 ASSERT_TRUE(LoadExtension(GetTestExtensionPath("bookmarks"))); |
| 132 // Navigate to chrome://bookmarks and check that the location bar URL is what | 132 // 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. | 133 // was entered and the internal URL uses the chrome-extension:// scheme. |
| 134 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); | 134 TestExtensionURLOverride(GURL(chrome::kChromeUIBookmarksURL)); |
| 135 } | 135 } |
| OLD | NEW |