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

Unified Diff: chrome/browser/policy/policy_browsertest.cc

Issue 12147004: Disable/enable echo for enterprise device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update some inline comments. Created 7 years, 10 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/policy/policy_browsertest.cc
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index b455aacdb744a3900df031421414f102ee9391d9..468e9c42f5ee0b3057424d1126ec5b98ab9ccd39 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -297,6 +297,21 @@ bool IsWebGLEnabled(content::WebContents* contents) {
return result;
}
+#if defined(OS_CHROMEOS)
+// Checks if redeeming cros offers is allowed in the given WebContents.
+bool CheckAllowRedeemCrosOffers(content::WebContents* contents) {
+ bool result = false;
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
+ contents,
+ "chrome.echoPrivate.allowRedeemOffers("
+ " function(allow) {"
+ " domAutomationController.send(allow);"
+ " });",
+ &result));
+ return result;
+}
oscarpan 2013/02/05 05:39:22 Apparently my test failed. It complained "Cannot c
Mattias Nissler (ping if slow) 2013/02/05 13:06:53 Have you made sure the extension is actually loade
oscarpan 2013/02/06 04:34:54 There are some tricky parts. First our extension i
+#endif
+
bool IsJavascriptEnabled(content::WebContents* contents) {
scoped_ptr<base::Value> value = content::ExecuteScriptAndGetValue(
contents->GetRenderViewHost(), "123");
@@ -1314,6 +1329,29 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, IncognitoEnabled) {
EXPECT_TRUE(BrowserList::IsOffTheRecordSessionActive());
}
+IN_PROC_BROWSER_TEST_F(PolicyTest, AllowRedeemChromeOsRegistrationOffers) {
+ content::WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ EXPECT_TRUE(CheckAllowRedeemCrosOffers(contents));
+
+ PolicyMap policies;
+ policies.Set(key::kDeviceAllowRedeemChromeOsRegistrationOffers,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE,
+ base::Value::CreateBooleanValue(false));
+
+ UpdateProviderPolicy(policies);
+ EXPECT_FALSE(CheckAllowRedeemCrosOffers(contents));
+
+ policies.Set(key::kDeviceAllowRedeemChromeOsRegistrationOffers,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE,
+ base::Value::CreateBooleanValue(true));
+
+ UpdateProviderPolicy(policies);
+ EXPECT_TRUE(CheckAllowRedeemCrosOffers(contents));
+}
+
IN_PROC_BROWSER_TEST_F(PolicyTest, Javascript) {
// Verifies that Javascript can be disabled.
content::WebContents* contents =

Powered by Google App Engine
This is Rietveld 408576698