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 "chrome/browser/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 scoped_feature_list.InitAndEnableFeature(features::kMaterialDesignSettings); | 123 scoped_feature_list.InitAndEnableFeature(features::kMaterialDesignSettings); |
124 | 124 |
125 std::string chrome_prefix(content::kChromeUIScheme); | 125 std::string chrome_prefix(content::kChromeUIScheme); |
126 chrome_prefix.append(url::kStandardSchemeSeparator); | 126 chrome_prefix.append(url::kStandardSchemeSeparator); |
127 std::vector<AboutURLTestCase> test_cases( | 127 std::vector<AboutURLTestCase> test_cases( |
128 {{GURL(chrome_prefix + chrome::kChromeUISettingsHost), | 128 {{GURL(chrome_prefix + chrome::kChromeUISettingsHost), |
129 GURL(chrome_prefix + chrome::kChromeUISettingsHost)}}); | 129 GURL(chrome_prefix + chrome::kChromeUISettingsHost)}}); |
130 TestWillHandleBrowserAboutURL(test_cases); | 130 TestWillHandleBrowserAboutURL(test_cases); |
131 } | 131 } |
132 | 132 |
| 133 TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURLForHistory) { |
| 134 TestWillHandleBrowserAboutURL(std::vector<AboutURLTestCase>({ |
| 135 {GURL("about:history"), GURL("chrome://history/")}, |
| 136 {GURL("about:history-frame"), GURL("chrome://history/")}, |
| 137 {GURL("chrome://history"), GURL("chrome://history/")}, |
| 138 {GURL("chrome://history-frame"), GURL("chrome://history/")}, |
| 139 {GURL("chrome://history/"), GURL("chrome://history/")}, |
| 140 {GURL("chrome://history-frame/"), GURL("chrome://history/")}, |
| 141 {GURL("chrome://history/?q=foo"), GURL("chrome://history/?q=foo")}, |
| 142 {GURL("chrome://history-frame/?q=foo"), GURL("chrome://history/?q=foo")}, |
| 143 })); |
| 144 } |
| 145 |
133 // Ensure that minor BrowserAboutHandler fixup to a URL does not cause us to | 146 // Ensure that minor BrowserAboutHandler fixup to a URL does not cause us to |
134 // keep a separate virtual URL, which would not be updated on redirects. | 147 // keep a separate virtual URL, which would not be updated on redirects. |
135 // See https://crbug.com/449829. | 148 // See https://crbug.com/449829. |
136 TEST_F(BrowserAboutHandlerTest, NoVirtualURLForFixup) { | 149 TEST_F(BrowserAboutHandlerTest, NoVirtualURLForFixup) { |
137 GURL url("view-source:http://.foo"); | 150 GURL url("view-source:http://.foo"); |
138 | 151 |
139 // Fixup will remove the dot and add a slash. | 152 // Fixup will remove the dot and add a slash. |
140 GURL fixed_url("view-source:http://foo/"); | 153 GURL fixed_url("view-source:http://foo/"); |
141 | 154 |
142 // Rewriters will remove the view-source prefix and expect it to stay in the | 155 // Rewriters will remove the view-source prefix and expect it to stay in the |
143 // virtual URL. | 156 // virtual URL. |
144 GURL rewritten_url("http://foo/"); | 157 GURL rewritten_url("http://foo/"); |
145 | 158 |
146 TestingProfile profile; | 159 TestingProfile profile; |
147 std::unique_ptr<NavigationEntry> entry( | 160 std::unique_ptr<NavigationEntry> entry( |
148 NavigationController::CreateNavigationEntry( | 161 NavigationController::CreateNavigationEntry( |
149 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), | 162 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), |
150 &profile)); | 163 &profile)); |
151 EXPECT_EQ(fixed_url, entry->GetVirtualURL()); | 164 EXPECT_EQ(fixed_url, entry->GetVirtualURL()); |
152 EXPECT_EQ(rewritten_url, entry->GetURL()); | 165 EXPECT_EQ(rewritten_url, entry->GetURL()); |
153 } | 166 } |
OLD | NEW |