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