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

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

Issue 541103002: Introduce ChromeZoomLevelPref, make zoom level prefs independent of profile prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revised Created 6 years, 2 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/off_the_record_profile_impl_unittest.cc
diff --git a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
index 62a79789d5d1a92b4eabfcac8c81f8430e932849..f8d1f740189a7317d42078e00a44acf3cf0b2585 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
@@ -9,6 +9,7 @@
#include "base/prefs/scoped_user_pref_update.h"
#include "base/run_loop.h"
#include "chrome/browser/prefs/browser_prefs.h"
+#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -27,11 +28,13 @@ namespace {
class TestingProfileWithHostZoomMap : public TestingProfile {
public:
TestingProfileWithHostZoomMap() {
- zoom_subscription_ =
- HostZoomMap::GetDefaultForBrowserContext(this)
- ->AddZoomLevelChangedCallback(
- base::Bind(&TestingProfileWithHostZoomMap::OnZoomLevelChanged,
- base::Unretained(this)));
+ HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this);
+ zoom_subscription_ = host_zoom_map->AddZoomLevelChangedCallback(
+ base::Bind(&TestingProfileWithHostZoomMap::OnZoomLevelChanged,
+ base::Unretained(this)));
+ zoom_level_prefs_.reset(
+ new chrome::ChromeZoomLevelPrefs(GetPrefs(), GetPath()));
+ zoom_level_prefs_->InitPrefsAndCopyToHostZoomMap(GetPath(), host_zoom_map);
}
virtual ~TestingProfileWithHostZoomMap() {}
@@ -50,7 +53,10 @@ class TestingProfileWithHostZoomMap : public TestingProfile {
HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this);
double level = change.zoom_level;
- DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels);
+ std::string per_host_zoom_levels(prefs::kPerHostZoomLevels);
+ per_host_zoom_levels.append(".0");
+ DictionaryPrefUpdate update(GetPrefs(),
+ prefs::kPerHostZoomLevels);
base::DictionaryValue* host_zoom_dictionary = update.Get();
if (content::ZoomValuesEqual(level, host_zoom_map->GetDefaultZoomLevel())) {
host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, NULL);
@@ -61,6 +67,7 @@ class TestingProfileWithHostZoomMap : public TestingProfile {
}
scoped_ptr<HostZoomMap::Subscription> zoom_subscription_;
+ scoped_ptr<chrome::ChromeZoomLevelPrefs> zoom_level_prefs_;
DISALLOW_COPY_AND_ASSIGN(TestingProfileWithHostZoomMap);
};

Powered by Google App Engine
This is Rietveld 408576698