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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h" 5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h"
6 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler.h" 6 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler.h"
7 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_mapper.h" 7 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_mapper.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_system.h"
11 #include "chrome/browser/extensions/extension_test_message_listener.h" 9 #include "chrome/browser/extensions/extension_test_message_listener.h"
12 #include "chrome/browser/extensions/platform_app_launcher.h" 10 #include "chrome/browser/extensions/platform_app_launcher.h"
13 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/sync/profile_sync_service.h" 12 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/browser/sync/profile_sync_service_factory.h" 13 #include "chrome/browser/sync/profile_sync_service_factory.h"
16 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
17 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
19 #include "google/cacheinvalidation/types.pb.h" 17 #include "google/cacheinvalidation/types.pb.h"
20 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 16 matching lines...) Expand all
37 MockInvalidationMapper::MockInvalidationMapper() {} 35 MockInvalidationMapper::MockInvalidationMapper() {}
38 MockInvalidationMapper::~MockInvalidationMapper() {} 36 MockInvalidationMapper::~MockInvalidationMapper() {}
39 37
40 class PushMessagingApiTest : public ExtensionApiTest { 38 class PushMessagingApiTest : public ExtensionApiTest {
41 public: 39 public:
42 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 40 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
43 ExtensionApiTest::SetUpCommandLine(command_line); 41 ExtensionApiTest::SetUpCommandLine(command_line);
44 } 42 }
45 43
46 PushMessagingEventRouter* GetEventRouter() { 44 PushMessagingEventRouter* GetEventRouter() {
47 return ExtensionSystem::Get(browser()->profile())->extension_service()-> 45 return PushMessagingAPI::Get(browser()->profile())->
48 push_messaging_event_router(); 46 push_messaging_event_router();
49 } 47 }
50 }; 48 };
51 49
52 IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, EventDispatch) { 50 IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, EventDispatch) {
53 ResultCatcher catcher; 51 ResultCatcher catcher;
54 catcher.RestrictToProfile(browser()->profile()); 52 catcher.RestrictToProfile(browser()->profile());
55 ExtensionTestMessageListener ready("ready", true); 53 ExtensionTestMessageListener ready("ready", true);
56 54
57 const extensions::Extension* extension = 55 const extensions::Extension* extension =
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const extensions::Extension* extension = 141 const extensions::Extension* extension =
144 LoadExtension(test_data_dir_.AppendASCII("push_messaging")); 142 LoadExtension(test_data_dir_.AppendASCII("push_messaging"));
145 ASSERT_TRUE(extension); 143 ASSERT_TRUE(extension);
146 ui_test_utils::NavigateToURL( 144 ui_test_utils::NavigateToURL(
147 browser(), extension->GetResourceURL("get_channel_id.html")); 145 browser(), extension->GetResourceURL("get_channel_id.html"));
148 146
149 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 147 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
150 } 148 }
151 149
152 } // namespace extensions 150 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698