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 7dea52e16fdeb77b301cd452852f1f422279e0a5..00c06032509779f03bf2f65c452a7ba66860c4f5 100644 |
--- a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc |
+++ b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc |
@@ -148,6 +148,33 @@ class SiteSettingsHandlerTest : public testing::Test { |
EXPECT_EQ(expected_incognito, incognito); |
} |
+ void ValidateZoom(const std::string& expected_host, |
+ const std::string& expected_zoom, 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("onZoomLevelsChanged", callback_id); |
+ |
+ const base::ListValue* exceptions; |
+ ASSERT_TRUE(data.arg2()->GetAsList(&exceptions)); |
+ EXPECT_EQ(1U, exceptions->GetSize()); |
+ |
+ const base::DictionaryValue* exception; |
+ ASSERT_TRUE(exceptions->GetDictionary(0, &exception)); |
+ |
+ std::string host; |
+ ASSERT_TRUE(exception->GetString("origin", &host)); |
+ ASSERT_EQ(expected_host, host); |
+ |
+ std::string zoom; |
+ ASSERT_TRUE(exception->GetString("zoom", &zoom)); |
+ ASSERT_EQ(expected_zoom, zoom); |
+ } |
+ |
void CreateIncognitoProfile() { |
incognito_profile_ = TestingProfile::Builder().BuildIncognito(&profile_); |
} |
@@ -253,4 +280,24 @@ TEST_F(SiteSettingsHandlerTest, Incognito) { |
ValidateIncognitoExists(false, 3U); |
} |
+TEST_F(SiteSettingsHandlerTest, ZoomLevels) { |
+ std::string host("http://www.google.com"); |
+ double zoom_level = 1.1; |
+ |
+ content::HostZoomMap* host_zoom_map = |
+ content::HostZoomMap::GetDefaultForBrowserContext(profile()); |
+ host_zoom_map->SetZoomLevelForHost(host, zoom_level); |
+ |
+ base::ListValue args; |
+ handler()->HandleFetchZoomLevels(&args); |
+ ValidateZoom(host, "122%", 1U); |
+ |
+ args.AppendString("http://www.google.com"); |
+ handler()->HandleRemoveZoomLevel(&args); |
+ |
+ double default_level = host_zoom_map->GetDefaultZoomLevel(); |
+ double level = host_zoom_map->GetZoomLevelForHostAndScheme("http", host); |
+ EXPECT_EQ(default_level, level); |
+} |
+ |
} // namespace settings |