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

Unified Diff: chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc

Issue 2630583002: Add setting to isolate zoom changes by default. (Closed)
Patch Set: ... and tell closure_compiler. Created 3 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/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
« no previous file with comments | « chrome/browser/ui/webui/settings/site_settings_handler.cc ('k') | chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698