Chromium Code Reviews| Index: chrome/browser/policy/policy_browsertest.cc |
| diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc |
| index f3c28ef3165f453410f5fc3c8c9bb241f12c5496..d6ae109d01e81fc436b88b08e1e54ba811c5373f 100644 |
| --- a/chrome/browser/policy/policy_browsertest.cc |
| +++ b/chrome/browser/policy/policy_browsertest.cc |
| @@ -1097,6 +1097,39 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DeveloperToolsDisabled) { |
| EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); |
| } |
| +bool ContainsElement(content::WebContents* contents, const std::string id) { |
|
Joao da Silva
2013/01/21 07:44:51
Helper functions like this come before the tests,
dconnelly
2013/01/21 09:39:03
Done.
|
| + bool result; |
| + EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| + contents, |
| + "domAutomationController.send(!!document.getElementById(\"" + id + "\"))", |
|
Joao da Silva
2013/01/21 07:44:51
Single quotes could be used instead of \"; just a
dconnelly
2013/01/21 09:39:03
Done.
|
| + &result)); |
| + return result; |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(PolicyTest, WebStoreIconHidden) { |
| + // Verifies that the web store icons can be hidden from the new tab page. |
| + |
| + // Open new tab page and look for the web store icons. |
| + ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
| + content::WebContents* contents = chrome::GetActiveWebContents(browser()); |
| + EXPECT_TRUE(ContainsElement(contents, "ahfgeienlihckogmohjhadlkjgocpleb")); |
|
Joao da Silva
2013/01/21 07:44:51
What does that ID refer to? Please comment it (I'm
dconnelly
2013/01/21 09:39:03
Done.
|
| + // The next NTP has no footer. |
| + if (ContainsElement(contents, "footer")) |
| + EXPECT_TRUE(ContainsElement(contents, "chrome-web-store-link")); |
|
Joao da Silva
2013/01/21 07:44:51
nit: indent (2 spaces instead of 4)
dconnelly
2013/01/21 09:39:03
Done.
|
| + |
| + // Turn off the web store icons. |
| + PolicyMap policies; |
| + policies.Set(key::kHideWebStoreIcon, POLICY_LEVEL_MANDATORY, |
| + POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true)); |
| + UpdateProviderPolicy(policies); |
| + |
| + // The web store icons should now be hidden. |
| + ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
| + contents = chrome::GetActiveWebContents(browser()); |
| + EXPECT_FALSE(ContainsElement(contents, "ahfgeienlihckogmohjhadlkjgocpleb")); |
| + EXPECT_FALSE(ContainsElement(contents, "chrome-web-store-link")); |
| +} |
| + |
| // This policy isn't available on Chrome OS. |
| #if !defined(OS_CHROMEOS) |
| IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) { |