| Index: chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
|
| diff --git a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
|
| index 070d4cab8bc75213eb3a7831ccc94503ac924b47..3a91922a127c4032b800879639c82a98b8a881ea 100644
|
| --- a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
|
| +++ b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
|
| @@ -203,6 +203,21 @@ class SiteSettingsHandlerTest : public testing::Test {
|
| }
|
| }
|
|
|
| + void ValidateZoomScope(bool expected_scope, size_t expected_total_calls) {
|
| + EXPECT_EQ(expected_total_calls, web_ui()->call_data().size());
|
| +
|
| + const content::TestWebUI::CallData& data = *web_ui()->call_data().back();
|
| + EXPECT_EQ("cr.webUIListenerCallback", data.function_name());
|
| +
|
| + std::string callback_id;
|
| + ASSERT_TRUE(data.arg1()->GetAsString(&callback_id));
|
| + EXPECT_EQ("onZoomScopeChanged", callback_id);
|
| +
|
| + bool is_per_origin;
|
| + ASSERT_TRUE(data.arg2()->GetAsBoolean(&is_per_origin));
|
| + EXPECT_EQ(expected_scope, is_per_origin);
|
| + }
|
| +
|
| void CreateIncognitoProfile() {
|
| incognito_profile_ = TestingProfile::Builder().BuildIncognito(&profile_);
|
| }
|
| @@ -389,4 +404,22 @@ TEST_F(SiteSettingsHandlerTest, ZoomLevels) {
|
| EXPECT_EQ(default_level, level);
|
| }
|
|
|
| +TEST_F(SiteSettingsHandlerTest, ZoomScope) {
|
| + ChromeZoomLevelPrefs* zoom_level_prefs = profile()->GetZoomLevelPrefs();
|
| + ASSERT_TRUE(zoom_level_prefs);
|
| + EXPECT_TRUE(zoom_level_prefs->GetZoomScopeIsPerOriginPref());
|
| +
|
| + zoom_level_prefs->SetZoomScopeIsPerOriginPref(false);
|
| + ValidateZoomScope(false, 1U);
|
| +
|
| + base::ListValue args;
|
| + handler()->HandleFetchZoomScope(&args);
|
| + ValidateZoomScope(false, 2U);
|
| +
|
| + args.AppendBoolean(true);
|
| + handler()->HandleSetZoomScopeIsPerOrigin(&args);
|
| + ValidateZoomScope(true, 3U);
|
| + EXPECT_TRUE(zoom_level_prefs->GetZoomScopeIsPerOriginPref());
|
| +}
|
| +
|
| } // namespace settings
|
|
|