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

Unified Diff: chrome/browser/search_engines/template_url_scraper_unittest.cc

Issue 23710022: Convert NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED to CallbackList (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/search_engines/template_url_scraper_unittest.cc
diff --git a/chrome/browser/search_engines/template_url_scraper_unittest.cc b/chrome/browser/search_engines/template_url_scraper_unittest.cc
index aa70734ecd5431d6d665e286d8fda02b4417f0f5..942580ea2d9992b46ba4af92e79e79af4831d43b 100644
--- a/chrome/browser/search_engines/template_url_scraper_unittest.cc
+++ b/chrome/browser/search_engines/template_url_scraper_unittest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "chrome/browser/search_engines/template_url_service.h"
@@ -10,8 +9,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "content/public/browser/notification_registrar.h"
-#include "content/public/browser/notification_source.h"
#include "net/base/net_util.h"
#include "net/dns/mock_host_resolver.h"
@@ -25,27 +22,19 @@ class TemplateURLScraperTest : public InProcessBrowserTest {
DISALLOW_COPY_AND_ASSIGN(TemplateURLScraperTest);
};
-class TemplateURLServiceLoader : public content::NotificationObserver {
+class TemplateURLServiceLoader {
public:
explicit TemplateURLServiceLoader(TemplateURLService* model) : model_(model) {
- registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED,
- content::Source<TemplateURLService>(model));
+ scoped_refptr<content::MessageLoopRunner> message_loop_runner =
+ new content::MessageLoopRunner;
+ scoped_ptr<TemplateURLService::Subscription> subscription =
+ model_->RegisterOnLoadedCallback(
+ message_loop_runner->QuitClosure());
model_->Load();
- content::RunMessageLoop();
- }
-
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED &&
- content::Source<TemplateURLService>(source).ptr() == model_) {
- base::MessageLoop::current()->Quit();
- }
+ message_loop_runner->Run();
}
private:
- content::NotificationRegistrar registrar_;
-
TemplateURLService* model_;
DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceLoader);
« no previous file with comments | « chrome/browser/search_engines/template_url_fetcher.cc ('k') | chrome/browser/search_engines/template_url_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698