| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 features::kMaterialDesignSettingsFeature.name, ""); | 118 features::kMaterialDesignSettingsFeature.name, ""); |
| 119 base::FeatureList::ClearInstanceForTesting(); | 119 base::FeatureList::ClearInstanceForTesting(); |
| 120 base::FeatureList::SetInstance(std::move(feature_list)); | 120 base::FeatureList::SetInstance(std::move(feature_list)); |
| 121 | 121 |
| 122 std::string chrome_prefix(content::kChromeUIScheme); | 122 std::string chrome_prefix(content::kChromeUIScheme); |
| 123 chrome_prefix.append(url::kStandardSchemeSeparator); | 123 chrome_prefix.append(url::kStandardSchemeSeparator); |
| 124 std::vector<AboutURLTestCase> test_cases( | 124 std::vector<AboutURLTestCase> test_cases( |
| 125 {{GURL(chrome_prefix + chrome::kChromeUISettingsHost), | 125 {{GURL(chrome_prefix + chrome::kChromeUISettingsHost), |
| 126 GURL(chrome_prefix + chrome::kChromeUISettingsHost)}, | 126 GURL(chrome_prefix + chrome::kChromeUISettingsHost)}, |
| 127 {GURL(chrome_prefix + chrome::kChromeUIHelpHost), | 127 {GURL(chrome_prefix + chrome::kChromeUIHelpHost), |
| 128 GURL(chrome_prefix + chrome::kChromeUIHelpHost)}}); | 128 GURL(chrome_prefix + chrome::kChromeUISettingsHost + "/" + |
| 129 chrome::kChromeUIHelpHost)}}); |
| 129 TestWillHandleBrowserAboutURL(test_cases); | 130 TestWillHandleBrowserAboutURL(test_cases); |
| 130 } | 131 } |
| 131 | 132 |
| 132 // Ensure that minor BrowserAboutHandler fixup to a URL does not cause us to | 133 // Ensure that minor BrowserAboutHandler fixup to a URL does not cause us to |
| 133 // keep a separate virtual URL, which would not be updated on redirects. | 134 // keep a separate virtual URL, which would not be updated on redirects. |
| 134 // See https://crbug.com/449829. | 135 // See https://crbug.com/449829. |
| 135 TEST_F(BrowserAboutHandlerTest, NoVirtualURLForFixup) { | 136 TEST_F(BrowserAboutHandlerTest, NoVirtualURLForFixup) { |
| 136 GURL url("view-source:http://.foo"); | 137 GURL url("view-source:http://.foo"); |
| 137 | 138 |
| 138 // Fixup will remove the dot and add a slash. | 139 // Fixup will remove the dot and add a slash. |
| 139 GURL fixed_url("view-source:http://foo/"); | 140 GURL fixed_url("view-source:http://foo/"); |
| 140 | 141 |
| 141 // Rewriters will remove the view-source prefix and expect it to stay in the | 142 // Rewriters will remove the view-source prefix and expect it to stay in the |
| 142 // virtual URL. | 143 // virtual URL. |
| 143 GURL rewritten_url("http://foo/"); | 144 GURL rewritten_url("http://foo/"); |
| 144 | 145 |
| 145 TestingProfile profile; | 146 TestingProfile profile; |
| 146 std::unique_ptr<NavigationEntry> entry( | 147 std::unique_ptr<NavigationEntry> entry( |
| 147 NavigationController::CreateNavigationEntry( | 148 NavigationController::CreateNavigationEntry( |
| 148 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), | 149 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), |
| 149 &profile)); | 150 &profile)); |
| 150 EXPECT_EQ(fixed_url, entry->GetVirtualURL()); | 151 EXPECT_EQ(fixed_url, entry->GetVirtualURL()); |
| 151 EXPECT_EQ(rewritten_url, entry->GetURL()); | 152 EXPECT_EQ(rewritten_url, entry->GetURL()); |
| 152 } | 153 } |
| OLD | NEW |