Commit 0f1f65a2 authored by Tina Wang's avatar Tina Wang Committed by Commit Bot

[ios] Add EG test for blockPopups settings UI

Also added a helper api for setting the policy to integer.

Bug: 1131052, 1065522
Change-Id: I2c745f2e145c932fab21396afbd9e2689aba9d4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443635
Commit-Queue: Tina Wang <tinazwang@chromium.org>
Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813952}
parent 53b6c243
......@@ -68,8 +68,13 @@ void SetPolicy(bool enabled, const std::string& policy_key) {
SetPolicy(base::Value(enabled), policy_key);
}
// Sets the value of the policy with the |policy_key| key to the given integer
// value.
void SetPolicy(int value, const std::string& policy_key) {
SetPolicy(base::Value(value), policy_key);
}
// TODO(crbug.com/1065522): Add helpers as needed for:
// - INTEGER
// - STRING
// - LIST (and subtypes, e.g. int list, string list, etc)
// - DICTIONARY (and subtypes, e.g. int dictionary, string dictionary, etc)
......@@ -327,6 +332,23 @@ void VerifyManagedSettingItem(NSString* accessibilityID,
SetPolicy(true, policy::key::kTranslateEnabled);
}
- (void)testBlockPopupsSettingsUI {
// Set the policy to int value 2, which stands for "do not allow any site to
// show popups".
SetPolicy(2, policy::key::kDefaultPopupsSetting);
// Open settings menu and tap Content Settings setting.
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI
tapSettingsMenuButton:chrome_test_util::ContentSettingsButton()];
[[EarlGrey
selectElementWithMatcher:grey_accessibilityID(kSettingsBlockPopupsCellId)]
performAction:grey_tap()];
VerifyManagedSettingItem(@"blockPopupsContentView_managed",
@"block_popups_settings_view_controller");
}
// Test whether the managed item will be shown if a policy is set.
- (void)testPopupMenuItem {
// Setup a machine level policy.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment