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