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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/feature_list.h" | |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/test/scoped_feature_list.h" |
16 #include "chrome/common/chrome_features.h" | 16 #include "chrome/common/chrome_features.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
19 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
20 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
21 #include "content/public/common/referrer.h" | 21 #include "content/public/common/referrer.h" |
22 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread.h" |
23 #include "content/public/test/test_browser_thread_bundle.h" | 23 #include "content/public/test/test_browser_thread_bundle.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 { | 106 { |
107 GURL(chrome_prefix + chrome::kChromeUIHelpHost), | 107 GURL(chrome_prefix + chrome::kChromeUIHelpHost), |
108 GURL(chrome_prefix + chrome::kChromeUIUberHost + "/" + | 108 GURL(chrome_prefix + chrome::kChromeUIUberHost + "/" + |
109 chrome::kChromeUIHelpHost + "/"), | 109 chrome::kChromeUIHelpHost + "/"), |
110 }}); | 110 }}); |
111 TestWillHandleBrowserAboutURL(test_cases); | 111 TestWillHandleBrowserAboutURL(test_cases); |
112 } | 112 } |
113 #endif | 113 #endif |
114 | 114 |
115 TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURLForMDSettings) { | 115 TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURLForMDSettings) { |
116 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | 116 base::test::ScopedFeatureList scoped_feature_list; |
117 feature_list->InitializeFromCommandLine( | 117 scoped_feature_list.InitAndEnableFeature(features::kMaterialDesignSettings); |
118 features::kMaterialDesignSettings.name, ""); | |
119 base::FeatureList::ClearInstanceForTesting(); | |
120 base::FeatureList::SetInstance(std::move(feature_list)); | |
121 | 118 |
122 std::string chrome_prefix(content::kChromeUIScheme); | 119 std::string chrome_prefix(content::kChromeUIScheme); |
123 chrome_prefix.append(url::kStandardSchemeSeparator); | 120 chrome_prefix.append(url::kStandardSchemeSeparator); |
124 std::vector<AboutURLTestCase> test_cases( | 121 std::vector<AboutURLTestCase> test_cases( |
125 {{GURL(chrome_prefix + chrome::kChromeUISettingsHost), | 122 {{GURL(chrome_prefix + chrome::kChromeUISettingsHost), |
126 GURL(chrome_prefix + chrome::kChromeUISettingsHost)}, | 123 GURL(chrome_prefix + chrome::kChromeUISettingsHost)}, |
127 {GURL(chrome_prefix + chrome::kChromeUIHelpHost), | 124 {GURL(chrome_prefix + chrome::kChromeUIHelpHost), |
128 GURL(chrome_prefix + chrome::kChromeUISettingsHost + "/" + | 125 GURL(chrome_prefix + chrome::kChromeUISettingsHost + "/" + |
129 chrome::kChromeUIHelpHost)}}); | 126 chrome::kChromeUIHelpHost)}}); |
130 TestWillHandleBrowserAboutURL(test_cases); | 127 TestWillHandleBrowserAboutURL(test_cases); |
(...skipping 13 matching lines...) Expand all Loading... |
144 GURL rewritten_url("http://foo/"); | 141 GURL rewritten_url("http://foo/"); |
145 | 142 |
146 TestingProfile profile; | 143 TestingProfile profile; |
147 std::unique_ptr<NavigationEntry> entry( | 144 std::unique_ptr<NavigationEntry> entry( |
148 NavigationController::CreateNavigationEntry( | 145 NavigationController::CreateNavigationEntry( |
149 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), | 146 url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), |
150 &profile)); | 147 &profile)); |
151 EXPECT_EQ(fixed_url, entry->GetVirtualURL()); | 148 EXPECT_EQ(fixed_url, entry->GetVirtualURL()); |
152 EXPECT_EQ(rewritten_url, entry->GetURL()); | 149 EXPECT_EQ(rewritten_url, entry->GetURL()); |
153 } | 150 } |
OLD | NEW |