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

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

Issue 12039058: content: convert zoom notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b8572c57ddb74700beea107651abd375612e0173..4bd5c2b107e0c4855c6050794f480f81b2c3e2de 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
@@ -16,24 +16,25 @@
#include "chrome/test/base/testing_pref_service.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/host_zoom_map.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/notification_types.h"
using content::HostZoomMap;
namespace {
-class TestingProfileWithHostZoomMap : public TestingProfile,
- public content::NotificationObserver {
+class TestingProfileWithHostZoomMap : public TestingProfile {
public:
- TestingProfileWithHostZoomMap() {
- HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
- registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
- content::Source<HostZoomMap>(host_zoom_map));
+ TestingProfileWithHostZoomMap()
+ : zoom_callback_(
+ base::Bind(&TestingProfileWithHostZoomMap::OnZoomLevelChanged,
+ base::Unretained(this))) {
+ HostZoomMap::GetForBrowserContext(this)->AddZoomLevelChangedCallback(
+ zoom_callback_);
}
- virtual ~TestingProfileWithHostZoomMap() {}
+ virtual ~TestingProfileWithHostZoomMap() {
+ HostZoomMap::GetForBrowserContext(this)->RemoveZoomLevelChangedCallback(
+ zoom_callback_);
+ }
virtual Profile* GetOffTheRecordProfile() OVERRIDE {
if (!off_the_record_profile_.get())
@@ -45,12 +46,8 @@ class TestingProfileWithHostZoomMap : public TestingProfile,
return GetPrefs();
}
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE {
- const std::string& host =
- *(content::Details<const std::string>(details).ptr());
- DCHECK(type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED);
+ private:
+ void OnZoomLevelChanged(const std::string& host) {
if (host.empty())
return;
@@ -66,11 +63,11 @@ class TestingProfileWithHostZoomMap : public TestingProfile,
}
}
- private:
- content::NotificationRegistrar registrar_;
scoped_ptr<Profile> off_the_record_profile_;
scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_;
+ content::HostZoomMap::ZoomLevelChangedCallback zoom_callback_;
+
DISALLOW_COPY_AND_ASSIGN(TestingProfileWithHostZoomMap);
};
@@ -138,7 +135,7 @@ TEST_F(OffTheRecordProfileImplTest, GetHostZoomMap) {
ASSERT_EQ(parent_zoom_map->GetZoomLevel(host), zoom_level_25);
// TODO(yosin) We need to wait ProfileImpl::Observe done for
- // NOTIFICATION_ZOOM_LEVEL_CHANGED.
+ // OnZoomLevelChanged.
// Prepare child profile as off the record profile.
scoped_ptr<OffTheRecordProfileImpl> child_profile(
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698