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

Unified Diff: chrome/browser/extensions/api/push_messaging/push_messaging_apitest.cc

Issue 11496004: Lazy initialization for PushMessagingEventRouter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added InitializeEventRouter Created 8 years 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/extensions/api/push_messaging/push_messaging_apitest.cc
diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_apitest.cc b/chrome/browser/extensions/api/push_messaging/push_messaging_apitest.cc
index c881e88176b1925b79fa8591fd15ba69476f5f40..604f72f8bb9316224fc42e508117f202c79a3068 100644
--- a/chrome/browser/extensions/api/push_messaging/push_messaging_apitest.cc
+++ b/chrome/browser/extensions/api/push_messaging/push_messaging_apitest.cc
@@ -6,8 +6,6 @@
#include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h"
#include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_mapper.h"
#include "chrome/browser/extensions/extension_apitest.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_launcher.h"
#include "chrome/browser/profiles/profile.h"
@@ -44,8 +42,8 @@ class PushMessagingApiTest : public ExtensionApiTest {
}
PushMessagingEventRouter* GetEventRouter() {
- return ExtensionSystem::Get(browser()->profile())->extension_service()->
- push_messaging_event_router();
+ return PushMessagingAPI::Get(browser()->profile())->
+ GetEventRouterForTest();
}
};
@@ -102,6 +100,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, AutoRegistration) {
scoped_ptr<StrictMock<MockInvalidationMapper> > mapper(
new StrictMock<MockInvalidationMapper>);
StrictMock<MockInvalidationMapper>* unsafe_mapper = mapper.get();
+ PushMessagingAPI::Get(browser()->profile())->InitializeEventRouterForTest();
// PushMessagingEventRouter owns the mapper now.
GetEventRouter()->SetMapperForTest(
mapper.PassAs<PushMessagingInvalidationMapper>());
@@ -120,6 +119,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, AutoRegistration) {
// Tests that we re-register for invalidations on restart for extensions that
// are already installed.
IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, PRE_Restart) {
+ PushMessagingAPI::Get(browser()->profile())->InitializeEventRouterForTest();
PushMessagingInvalidationHandler* handler =
static_cast<PushMessagingInvalidationHandler*>(
GetEventRouter()->GetMapperForTest());
@@ -129,6 +129,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, PRE_Restart) {
}
IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, Restart) {
+ PushMessagingAPI::Get(browser()->profile())->InitializeEventRouterForTest();
PushMessagingInvalidationHandler* handler =
static_cast<PushMessagingInvalidationHandler*>(
GetEventRouter()->GetMapperForTest());

Powered by Google App Engine
This is Rietveld 408576698