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

Unified Diff: chrome/browser/profiles/host_zoom_map_browsertest.cc

Issue 1295323002: Remove profile-based per-host & default zoom level migration code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/profiles/host_zoom_map_browsertest.cc
diff --git a/chrome/browser/profiles/host_zoom_map_browsertest.cc b/chrome/browser/profiles/host_zoom_map_browsertest.cc
index e099154e9dc911193d0cc0f07f841cf32aa43661..4e6a59a13da8378ba8ac687e834460ffc7044ef6 100644
--- a/chrome/browser/profiles/host_zoom_map_browsertest.cc
+++ b/chrome/browser/profiles/host_zoom_map_browsertest.cc
@@ -355,92 +355,6 @@ IN_PROC_BROWSER_TEST_F(HostZoomMapSanitizationBrowserTest, ClearOnStartup) {
EXPECT_THAT(GetHostsWithZoomLevelsFromPrefs(), testing::ElementsAre("host2"));
}
-// In this case we migrate the zoom level data from the profile prefs.
gab 2015/08/18 20:39:40 Includes cleanup from https://codereview.chromium.
wjmaclean 2015/08/19 13:53:34 Did you want me to revert the changes to HostZoomM
gab 2015/08/20 16:34:28 Don't feel strongly there, feels like most of the
-const char kMigrationTestPrefs[] =
- "{'profile': {"
- " 'default_zoom_level': 1.2,"
- " 'per_host_zoom_levels': {'': 1.1, 'host1': 1.20001, 'host2': "
- "1.3}"
- "}}";
-
-class HostZoomMapMigrationBrowserTest : public HostZoomMapBrowserTestWithPrefs {
- public:
- HostZoomMapMigrationBrowserTest()
- : HostZoomMapBrowserTestWithPrefs(kMigrationTestPrefs) {}
-
- static const double kOriginalDefaultZoomLevel;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(HostZoomMapMigrationBrowserTest);
-};
-
-const double HostZoomMapMigrationBrowserTest::kOriginalDefaultZoomLevel = 1.2;
-
-// This test is the same as HostZoomMapSanitizationBrowserTest, except that the
-// zoom level data is loaded from the profile prefs, transfered to the
-// zoom-level prefs, and we verify that the profile zoom level prefs are
-// erased in the process. We also test that changes to the host zoom map and the
-// default zoom level don't propagate back to the profile prefs.
-IN_PROC_BROWSER_TEST_F(HostZoomMapMigrationBrowserTest,
- MigrateProfileZoomPreferences) {
- EXPECT_THAT(GetHostsWithZoomLevels(), testing::ElementsAre("host2"));
- EXPECT_THAT(GetHostsWithZoomLevelsFromPrefs(), testing::ElementsAre("host2"));
-
- PrefService* profile_prefs =
- browser()->profile()->GetPrefs();
- chrome::ChromeZoomLevelPrefs* zoom_level_prefs =
- browser()->profile()->GetZoomLevelPrefs();
- // Make sure that the profile pref for default zoom level has been set to
- // its default value of 0.0.
- EXPECT_EQ(0.0, profile_prefs->GetDouble(prefs::kDefaultZoomLevelDeprecated));
- EXPECT_EQ(kOriginalDefaultZoomLevel,
- zoom_level_prefs->GetDefaultZoomLevelPref());
-
- // Make sure that the profile prefs for per-host zoom levels are erased.
- {
- const base::DictionaryValue* profile_host_zoom_dictionary =
- profile_prefs->GetDictionary(prefs::kPerHostZoomLevelsDeprecated);
- EXPECT_EQ(0UL, profile_host_zoom_dictionary->size());
- }
-
- ZoomLevelChangeObserver observer(browser()->profile());
- content::HostZoomMap* host_zoom_map = static_cast<content::HostZoomMap*>(
- content::HostZoomMap::GetDefaultForBrowserContext(
- browser()->profile()));
-
- // Make sure that a change to a host zoom level doesn't propagate to the
- // profile prefs.
- std::string host3("host3");
- host_zoom_map->SetZoomLevelForHost(host3, 1.3);
- observer.BlockUntilZoomLevelForHostHasChanged(host3);
- EXPECT_THAT(GetHostsWithZoomLevelsFromPrefs(),
- testing::ElementsAre("host2", host3));
- {
- const base::DictionaryValue* profile_host_zoom_dictionary =
- profile_prefs->GetDictionary(prefs::kPerHostZoomLevelsDeprecated);
- EXPECT_EQ(0UL, profile_host_zoom_dictionary->size());
- }
-
- // Make sure a change to the default zoom level doesn't propagate to the
- // profile prefs.
-
- // First, we need a host at the default zoom level to respond when the
- // default zoom level changes.
- const double kNewDefaultZoomLevel = 1.5;
- GURL test_url = ConstructTestServerURL("http://host4:%u/");
- ui_test_utils::NavigateToURL(browser(), test_url);
- EXPECT_TRUE(content::ZoomValuesEqual(kOriginalDefaultZoomLevel,
- GetZoomLevel(test_url)));
-
- // Change the default zoom level and observe.
- SetDefaultZoomLevel(kNewDefaultZoomLevel);
- observer.BlockUntilZoomLevelForHostHasChanged(test_url.host());
- EXPECT_TRUE(
- content::ZoomValuesEqual(kNewDefaultZoomLevel, GetZoomLevel(test_url)));
- EXPECT_EQ(kNewDefaultZoomLevel, zoom_level_prefs->GetDefaultZoomLevelPref());
- EXPECT_EQ(0.0, profile_prefs->GetDouble(prefs::kDefaultZoomLevelDeprecated));
-}
-
// Test four things:
// 1. Host zoom maps of parent profile and child profile are different.
// 2. Child host zoom map inherits zoom level at construction.

Powered by Google App Engine
This is Rietveld 408576698