Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(881)

Side by Side Diff: chrome/browser/chrome_content_browser_client_browsertest.cc

Issue 2913343002: Start removing deprecated Options UI code (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
37 void SetUpInProcessBrowserTestFixture() override {
38 disable_md_settings_.InitAndDisableFeature(
39 features::kMaterialDesignSettings);
40 }
41
42 #if defined(OS_CHROMEOS)
43 void SetUpCommandLine(base::CommandLine* command_line) override {
44 command_line->AppendSwitch(switches::kDisableSettingsWindow);
45 }
46 #endif
47
48 private:
49 base::test::ScopedFeatureList disable_md_settings_;
50 }; 34 };
51 35
52 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, 36 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
53 UberURLHandler_SettingsPage) {
54 const GURL url_short("chrome://settings/");
55 const GURL url_long("chrome://chrome/settings/");
56
57 ui_test_utils::NavigateToURL(browser(), url_short);
58 NavigationEntry* entry = GetLastCommittedEntry();
59
60 ASSERT_TRUE(entry != NULL);
61 EXPECT_EQ(url_long, entry->GetURL());
62 EXPECT_EQ(url_short, entry->GetVirtualURL());
63 }
64
65 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
66 UberURLHandler_ContentSettingsPage) {
67 const GURL url_short("chrome://settings/content");
68 const GURL url_long("chrome://chrome/settings/content");
69
70 ui_test_utils::NavigateToURL(browser(), url_short);
71 NavigationEntry* entry = GetLastCommittedEntry();
72
73 ASSERT_TRUE(entry != NULL);
74 EXPECT_EQ(url_long, entry->GetURL());
75 EXPECT_EQ(url_short, entry->GetVirtualURL());
76 }
77
78 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
79 UberURLHandler_AboutPage) { 37 UberURLHandler_AboutPage) {
80 const GURL url("chrome://chrome/"); 38 const GURL url("chrome://chrome/");
81 39
82 ui_test_utils::NavigateToURL(browser(), url); 40 ui_test_utils::NavigateToURL(browser(), url);
83 NavigationEntry* entry = GetLastCommittedEntry(); 41 NavigationEntry* entry = GetLastCommittedEntry();
84 42
85 ASSERT_TRUE(entry != NULL); 43 ASSERT_TRUE(entry != NULL);
86 EXPECT_EQ(url, entry->GetURL()); 44 EXPECT_EQ(url, entry->GetURL());
87 EXPECT_EQ(url, entry->GetVirtualURL()); 45 EXPECT_EQ(url, entry->GetVirtualURL());
88 } 46 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 106
149 ui_test_utils::NavigateToURL(browser(), url); 107 ui_test_utils::NavigateToURL(browser(), url);
150 NavigationEntry* entry = GetLastCommittedEntry(); 108 NavigationEntry* entry = GetLastCommittedEntry();
151 109
152 ASSERT_TRUE(entry != NULL); 110 ASSERT_TRUE(entry != NULL);
153 EXPECT_EQ(url, entry->GetURL()); 111 EXPECT_EQ(url, entry->GetURL());
154 EXPECT_EQ(url, entry->GetVirtualURL()); 112 EXPECT_EQ(url, entry->GetVirtualURL());
155 } 113 }
156 114
157 } // namespace content 115 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698