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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/test/scoped_feature_list.h" |
7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 12 #include "chrome/common/chrome_features.h" |
11 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
13 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
16 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
17 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
18 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
19 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
20 #include "content/public/test/browser_test_utils.h" | 22 #include "content/public/test/browser_test_utils.h" |
21 #include "net/test/embedded_test_server/embedded_test_server.h" | 23 #include "net/test/embedded_test_server/embedded_test_server.h" |
22 #include "url/gurl.h" | 24 #include "url/gurl.h" |
23 | 25 |
24 namespace content { | 26 namespace content { |
25 | 27 |
26 class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest { | 28 class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest { |
27 public: | 29 public: |
28 // Returns the last committed navigation entry of the first tab. May be NULL | 30 // Returns the last committed navigation entry of the first tab. May be NULL |
29 // if there is no such entry. | 31 // if there is no such entry. |
30 NavigationEntry* GetLastCommittedEntry() { | 32 NavigationEntry* GetLastCommittedEntry() { |
31 return browser()->tab_strip_model()->GetWebContentsAt(0)-> | 33 return browser()->tab_strip_model()->GetWebContentsAt(0)-> |
32 GetController().GetLastCommittedEntry(); | 34 GetController().GetLastCommittedEntry(); |
33 } | 35 } |
34 | 36 |
| 37 void SetUpInProcessBrowserTestFixture() override { |
| 38 disable_md_settings_.InitAndDisableFeature( |
| 39 features::kMaterialDesignSettings); |
| 40 } |
| 41 |
35 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
36 void SetUpCommandLine(base::CommandLine* command_line) override { | 43 void SetUpCommandLine(base::CommandLine* command_line) override { |
37 command_line->AppendSwitch(switches::kDisableSettingsWindow); | 44 command_line->AppendSwitch(switches::kDisableSettingsWindow); |
38 } | 45 } |
39 #endif | 46 #endif |
| 47 |
| 48 private: |
| 49 base::test::ScopedFeatureList disable_md_settings_; |
40 }; | 50 }; |
41 | 51 |
42 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, | 52 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, |
43 UberURLHandler_SettingsPage) { | 53 UberURLHandler_SettingsPage) { |
44 const GURL url_short("chrome://settings/"); | 54 const GURL url_short("chrome://settings/"); |
45 const GURL url_long("chrome://chrome/settings/"); | 55 const GURL url_long("chrome://chrome/settings/"); |
46 | 56 |
47 ui_test_utils::NavigateToURL(browser(), url_short); | 57 ui_test_utils::NavigateToURL(browser(), url_short); |
48 NavigationEntry* entry = GetLastCommittedEntry(); | 58 NavigationEntry* entry = GetLastCommittedEntry(); |
49 | 59 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 148 |
139 ui_test_utils::NavigateToURL(browser(), url); | 149 ui_test_utils::NavigateToURL(browser(), url); |
140 NavigationEntry* entry = GetLastCommittedEntry(); | 150 NavigationEntry* entry = GetLastCommittedEntry(); |
141 | 151 |
142 ASSERT_TRUE(entry != NULL); | 152 ASSERT_TRUE(entry != NULL); |
143 EXPECT_EQ(url, entry->GetURL()); | 153 EXPECT_EQ(url, entry->GetURL()); |
144 EXPECT_EQ(url, entry->GetVirtualURL()); | 154 EXPECT_EQ(url, entry->GetVirtualURL()); |
145 } | 155 } |
146 | 156 |
147 } // namespace content | 157 } // namespace content |
OLD | NEW |