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

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: callbacks Created 7 years, 11 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 69e11048dbc70b5ba35451432df85f2b440e21aa..bc8b3c39b71702398e6bc0458574727ba4a0132e 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc
@@ -15,24 +15,23 @@
#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;
+using content::HostZoomMapObserver;
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));
+ HostZoomMap::GetForBrowserContext(this)->AddZoomLevelChangedCallback(
+ base::Bind(&TestingProfileWithHostZoomMap::OnZoomLevelChanged, this));
}
- virtual ~TestingProfileWithHostZoomMap() {}
+ virtual ~TestingProfileWithHostZoomMap() {
+ HostZoomMap::GetForBrowserContext(this)->RemoveZoomLevelChangedCallback(
+ base::Bind(&TestingProfileWithHostZoomMap::OnZoomLevelChanged, this));
+ }
virtual Profile* GetOffTheRecordProfile() OVERRIDE {
if (!off_the_record_profile_.get())
@@ -44,12 +43,7 @@ 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);
+ void OnZoomLevelChanged(const std::string& host) {
if (host.empty())
return;
@@ -66,7 +60,6 @@ class TestingProfileWithHostZoomMap : public TestingProfile,
}
private:
- content::NotificationRegistrar registrar_;
scoped_ptr<Profile> off_the_record_profile_;
scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_;
@@ -137,7 +130,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.
+ // content::HostZoomMapObserver::OnZoomLevelChanged.
// Prepare child profile as off the record profile.
scoped_ptr<OffTheRecordProfileImpl> child_profile(

Powered by Google App Engine
This is Rietveld 408576698