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

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: Address comments (use WeakPtr in callback). Created 6 years, 3 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..f80b58bc124b953a4ff9add13fc35ef691d6b842 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
@@ -4,11 +4,13 @@
#include "chrome/browser/profiles/off_the_record_profile_impl.h"
+//#include "base/files/file_path.h"
Bernhard Bauer 2014/09/12 10:28:49 Remove
wjmaclean 2014/09/16 18:44:44 Opps, removed!
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
#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/zoom_level_prefs_store_impl.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 +29,12 @@ 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::ZoomLevelPrefsStoreImpl);
+ zoom_level_prefs_->InitPrefsAndCopyToHostZoomMap(GetPath(), host_zoom_map);
}
virtual ~TestingProfileWithHostZoomMap() {}
@@ -50,7 +53,8 @@ class TestingProfileWithHostZoomMap : public TestingProfile {
HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this);
double level = change.zoom_level;
- DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels);
+ DictionaryPrefUpdate update(zoom_level_prefs_->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 +65,7 @@ class TestingProfileWithHostZoomMap : public TestingProfile {
}
scoped_ptr<HostZoomMap::Subscription> zoom_subscription_;
+ scoped_ptr<chrome::ZoomLevelPrefsStoreImpl> zoom_level_prefs_;
DISALLOW_COPY_AND_ASSIGN(TestingProfileWithHostZoomMap);
};

Powered by Google App Engine
This is Rietveld 408576698