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

Unified Diff: chrome/browser/ui/webui/policy_ui_browsertest.cc

Issue 1321713004: Flag for Material Design policy construction page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified test instantiation. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/policy_ui_browsertest.cc
diff --git a/chrome/browser/ui/webui/policy_ui_browsertest.cc b/chrome/browser/ui/webui/policy_ui_browsertest.cc
index b7ae8a166d84317a718e80f13e59083c0c474126..894078b6706095af829fc85b51b953e1d2826a49 100644
--- a/chrome/browser/ui/webui/policy_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/policy_ui_browsertest.cc
@@ -5,6 +5,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_reader.h"
#include "base/run_loop.h"
@@ -14,6 +15,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -88,11 +90,18 @@ std::vector<std::string> PopulateExpectedPolicy(
} // namespace
-class PolicyUITest : public InProcessBrowserTest {
+class PolicyUITest
+ : public InProcessBrowserTest,
+ public testing::WithParamInterface<bool> {
public:
PolicyUITest();
~PolicyUITest() override;
+ // InProcessBrowserTest:
+ void SetUpCommandLine(base::CommandLine* command_line) override;
+
+ GURL url() const;
+
protected:
// InProcessBrowserTest implementation.
void SetUpInProcessBrowserTestFixture() override;
@@ -105,15 +114,29 @@ class PolicyUITest : public InProcessBrowserTest {
policy::MockConfigurationPolicyProvider provider_;
private:
+ bool has_material_design_flag_;
+
DISALLOW_COPY_AND_ASSIGN(PolicyUITest);
};
-PolicyUITest::PolicyUITest() {
+PolicyUITest::PolicyUITest() : has_material_design_flag_(GetParam()) {
}
PolicyUITest::~PolicyUITest() {
}
+GURL PolicyUITest::url() const {
+ return GURL(has_material_design_flag_ ?
+ chrome::kChromeUIPolicyInternalsURL :
+ chrome::kChromeUIPolicyURL);
+}
+
+void PolicyUITest::SetUpCommandLine(base::CommandLine* command_line) {
+ InProcessBrowserTest::SetUpCommandLine(command_line);
+ if (has_material_design_flag_)
+ command_line->AppendSwitch(switches::kEnableMaterialDesignPolicyPage);
+}
+
void PolicyUITest::SetUpInProcessBrowserTestFixture() {
EXPECT_CALL(provider_, IsInitializationComplete(_))
.WillRepeatedly(Return(true));
@@ -128,7 +151,7 @@ void PolicyUITest::UpdateProviderPolicy(const policy::PolicyMap& policy) {
void PolicyUITest::VerifyPolicies(
const std::vector<std::vector<std::string> >& expected_policies) {
- ui_test_utils::NavigateToURL(browser(), GURL("chrome://policy"));
+ ui_test_utils::NavigateToURL(browser(), url());
// Retrieve the text contents of the policy table cells for all policies.
const std::string javascript =
@@ -176,7 +199,7 @@ void PolicyUITest::VerifyPolicies(
}
}
-IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyNames) {
+IN_PROC_BROWSER_TEST_P(PolicyUITest, SendPolicyNames) {
// Verifies that the names of known policies are sent to the UI and processed
// there correctly by checking that the policy table contains all policies in
// the correct order.
@@ -199,7 +222,7 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyNames) {
VerifyPolicies(expected_policies);
}
-IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyValues) {
+IN_PROC_BROWSER_TEST_P(PolicyUITest, SendPolicyValues) {
// Verifies that policy values are sent to the UI and processed there
// correctly by setting the values of four known and one unknown policy and
// checking that the policy table contains the policy names, values and
@@ -287,8 +310,8 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyValues) {
VerifyPolicies(expected_policies);
}
-IN_PROC_BROWSER_TEST_F(PolicyUITest, ExtensionLoadAndSendPolicy) {
- ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIPolicyURL));
+IN_PROC_BROWSER_TEST_P(PolicyUITest, ExtensionLoadAndSendPolicy) {
+ ui_test_utils::NavigateToURL(browser(), url());
base::ScopedTempDir temp_dir_;
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
@@ -340,3 +363,7 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, ExtensionLoadAndSendPolicy) {
// Verify if policy UI includes policy that extension have.
VerifyPolicies(expected_policies);
}
+
+INSTANTIATE_TEST_CASE_P(FlaggedPolicyUITest,
+ PolicyUITest,
+ testing::Bool());

Powered by Google App Engine
This is Rietveld 408576698