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

Side by Side Diff: chrome/browser/ui/webui/uber/uber_ui_browsertest.cc

Issue 1766273002: Convert --enable-md-history to a feature flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update tests to use the new feature flags instead of the existing Created 4 years, 9 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/test_extension_system.h" 11 #include "chrome/browser/extensions/test_extension_system.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
18 #include "chrome/test/base/web_ui_browser_test.h" 18 #include "chrome/test/base/web_ui_browser_test.h"
19 #include "content/public/common/content_switches.h"
19 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
20 #include "extensions/browser/extension_registry.h" 21 #include "extensions/browser/extension_registry.h"
21 #include "extensions/common/extension.h" 22 #include "extensions/common/extension.h"
22 #include "extensions/common/extension_builder.h" 23 #include "extensions/common/extension_builder.h"
23 24
24 class UberUIBrowserTest : public WebUIBrowserTest { 25 class UberUIBrowserTest : public WebUIBrowserTest {
25 public: 26 public:
26 UberUIBrowserTest() {} 27 UberUIBrowserTest() {}
27 ~UberUIBrowserTest() override {} 28 ~UberUIBrowserTest() override {}
28 29
29 bool GetJsBool(const char* js) { 30 bool GetJsBool(const char* js) {
30 bool result = false; 31 bool result = false;
31 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 32 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
32 GetWebContents(), 33 GetWebContents(),
33 std::string("domAutomationController.send(") + js + ");", 34 std::string("domAutomationController.send(") + js + ");",
34 &result)); 35 &result));
35 return result; 36 return result;
36 } 37 }
37 38
38 void RunJs(const char* js) { 39 void RunJs(const char* js) {
39 ASSERT_TRUE(content::ExecuteScript(GetWebContents(), js)); 40 ASSERT_TRUE(content::ExecuteScript(GetWebContents(), js));
40 } 41 }
41 42
42 void SelectTab() { 43 void SelectTab() {
43 RunJs("var data = {pageId: 'history'};" 44 RunJs("var data = {pageId: 'history'};"
44 "uber.invokeMethodOnWindow(this, 'changeSelection', data);"); 45 "uber.invokeMethodOnWindow(this, 'changeSelection', data);");
45 } 46 }
46 47
48 void SetUpCommandLine(base::CommandLine* command_line) override {
49 command_line->AppendSwitchASCII(
50 ::switches::kEnableFeatures,
51 ::switches::kMaterialDesignHistoryFeature.name);
52 }
53
47 private: 54 private:
48 content::WebContents* GetWebContents() { 55 content::WebContents* GetWebContents() {
49 return browser()->tab_strip_model()->GetActiveWebContents(); 56 return browser()->tab_strip_model()->GetActiveWebContents();
50 } 57 }
51 58
52 DISALLOW_COPY_AND_ASSIGN(UberUIBrowserTest); 59 DISALLOW_COPY_AND_ASSIGN(UberUIBrowserTest);
53 }; 60 };
54 61
55 IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, HistoryOverride) { 62 IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, HistoryOverride) {
56 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL)); 63 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL));
(...skipping 28 matching lines...) Expand all
85 92
86 IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, EnableMdExtensionsHidesExtensions) { 93 IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, EnableMdExtensionsHidesExtensions) {
87 base::CommandLine::ForCurrentProcess()->AppendSwitch( 94 base::CommandLine::ForCurrentProcess()->AppendSwitch(
88 ::switches::kEnableMaterialDesignExtensions); 95 ::switches::kEnableMaterialDesignExtensions);
89 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL)); 96 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL));
90 SelectTab(); 97 SelectTab();
91 EXPECT_TRUE(GetJsBool("$('extensions').hidden")); 98 EXPECT_TRUE(GetJsBool("$('extensions').hidden"));
92 } 99 }
93 100
94 IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, EnableMdHistoryHidesHistory) { 101 IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, EnableMdHistoryHidesHistory) {
95 base::CommandLine::ForCurrentProcess()->AppendSwitch(
96 ::switches::kEnableMaterialDesignHistory);
97 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL)); 102 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL));
98 SelectTab(); 103 SelectTab();
99 EXPECT_TRUE(GetJsBool("$('history').hidden")); 104 EXPECT_TRUE(GetJsBool("$('history').hidden"));
100 } 105 }
101 106
102 IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, 107 IN_PROC_BROWSER_TEST_F(UberUIBrowserTest,
103 EnableSettingsWindowHidesSettingsAndHelp) { 108 EnableSettingsWindowHidesSettingsAndHelp) {
104 base::CommandLine::ForCurrentProcess()->AppendSwitch( 109 base::CommandLine::ForCurrentProcess()->AppendSwitch(
105 ::switches::kEnableSettingsWindow); 110 ::switches::kEnableSettingsWindow);
106 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL)); 111 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIUberFrameURL));
107 SelectTab(); 112 SelectTab();
108 EXPECT_TRUE(GetJsBool("$('settings').hidden && $('help').hidden")); 113 EXPECT_TRUE(GetJsBool("$('settings').hidden && $('help').hidden"));
109 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698