Index: chrome/browser/chrome_content_browser_client_browsertest.cc |
diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc |
index 46bcbd6d12b01f83c2fac5389ee7e58c643fcfd8..078b39ab9ee2164440fb49f7f57459f4c18ebe02 100644 |
--- a/chrome/browser/chrome_content_browser_client_browsertest.cc |
+++ b/chrome/browser/chrome_content_browser_client_browsertest.cc |
@@ -14,6 +14,15 @@ |
#include "content/public/common/content_switches.h" |
#include "url/gurl.h" |
+#if defined(OS_CHROMEOS) |
+#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
+#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
+#include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" |
+#include "components/policy/core/common/mock_configuration_policy_provider.h" |
+#include "components/policy/core/common/policy_types.h" |
+#endif |
+ |
namespace content { |
class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest { |
@@ -29,6 +38,17 @@ class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest { |
void SetUpCommandLine(base::CommandLine* command_line) override { |
command_line->AppendSwitch(switches::kDisableAboutInSettings); |
} |
+ |
+ protected: |
+ void SetUpInProcessBrowserTestFixture() override { |
+ // Set up fake install attributes. |
+ scoped_ptr<policy::StubEnterpriseInstallAttributes> attributes( |
+ new policy::StubEnterpriseInstallAttributes()); |
+ attributes->SetDomain("example.com"); |
+ attributes->SetRegistrationUser("user@example.com"); |
+ policy::BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting( |
+ attributes.release()); |
+ } |
#endif |
}; |
@@ -100,4 +120,22 @@ IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, |
EXPECT_EQ(url, entry->GetVirtualURL()); |
} |
+#if defined(OS_CHROMEOS) |
+// Test that the disable Easter Egg switch is appended if Chrome OS and |
+// the device is enterprise enrolled. |
+IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, |
+ ShouldDisableEasterEgg) { |
+ const base::CommandLine& browser_command_line = |
+ *base::CommandLine::ForCurrentProcess(); |
+ |
+ policy::BrowserPolicyConnectorChromeOS* connector = |
+ g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
+ bool is_enterprise_managed = connector->IsEnterpriseManaged(); |
+ |
+ EXPECT_TRUE(is_enterprise_managed); |
+ EXPECT_TRUE(browser_command_line.HasSwitch( |
Andrew T Wilson (Slow)
2015/03/13 13:44:57
This will fail, because you aren't setting the swi
edwardjung
2015/03/13 16:09:06
Okay understood, so how do I go about getting the
Andrew T Wilson (Slow)
2015/03/13 16:52:27
Great question. I don't write many tests that invo
edwardjung
2015/03/16 13:30:59
I've moved this test to errorpage_browsertests sin
|
+ switches::kDisableDinosaurEasterEgg)); |
+} |
+#endif |
+ |
} // namespace content |