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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/push_messaging_apitest.cc

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another test 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 | Annotate | Revision Log
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" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 PushMessagingEventRouter* GetEventRouter() { 46 PushMessagingEventRouter* GetEventRouter() {
47 return ExtensionSystem::Get(browser()->profile())->extension_service()-> 47 return ExtensionSystem::Get(browser()->profile())->extension_service()->
48 push_messaging_event_router(); 48 push_messaging_event_router();
49 } 49 }
50 }; 50 };
51 51
52 IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, EventDispatch) { 52 IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, EventDispatch) {
53 ResultCatcher catcher; 53 ResultCatcher catcher;
54 catcher.RestrictToProfile(browser()->profile()); 54 catcher.RestrictToProfile(browser()->profile());
55 ExtensionTestMessageListener ready("ready", true); 55 ExtensionTestMessageListener ready("ready", false);
56 56
57 const extensions::Extension* extension = 57 const extensions::Extension* extension =
58 LoadExtension(test_data_dir_.AppendASCII("push_messaging")); 58 LoadExtension(test_data_dir_.AppendASCII("push_messaging"));
59 ASSERT_TRUE(extension); 59 ASSERT_TRUE(extension);
60 ui_test_utils::NavigateToURL( 60 ui_test_utils::NavigateToURL(
61 browser(), extension->GetResourceURL("event_dispatch.html")); 61 browser(), extension->GetResourceURL("event_dispatch.html"));
62 EXPECT_TRUE(ready.WaitUntilSatisfied()); 62 EXPECT_TRUE(ready.WaitUntilSatisfied());
63 63
64 GetEventRouter()->TriggerMessageForTest(extension->id(), 1, "payload"); 64 GetEventRouter()->TriggerMessageForTest(extension->id(), 1, "payload");
65 65
66 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 66 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
67 } 67 }
68 68
69 // Test that a push introduced into the sync code makes it to the extension 69 // Test that a push introduced into the sync code makes it to the extension
70 // that we install. 70 // that we install.
71 IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, ReceivesPush) { 71 IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, ReceivesPush) {
72 ResultCatcher catcher; 72 ResultCatcher catcher;
73 catcher.RestrictToProfile(browser()->profile()); 73 catcher.RestrictToProfile(browser()->profile());
74 ExtensionTestMessageListener ready("ready", true); 74 ExtensionTestMessageListener ready("ready", false);
75 75
76 const extensions::Extension* extension = 76 const extensions::Extension* extension =
77 LoadExtension(test_data_dir_.AppendASCII("push_messaging")); 77 LoadExtension(test_data_dir_.AppendASCII("push_messaging"));
78 ASSERT_TRUE(extension); 78 ASSERT_TRUE(extension);
79 ui_test_utils::NavigateToURL( 79 ui_test_utils::NavigateToURL(
80 browser(), extension->GetResourceURL("event_dispatch.html")); 80 browser(), extension->GetResourceURL("event_dispatch.html"));
81 EXPECT_TRUE(ready.WaitUntilSatisfied()); 81 EXPECT_TRUE(ready.WaitUntilSatisfied());
82 82
83 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile( 83 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(
84 browser()->profile()); 84 browser()->profile());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const extensions::Extension* extension = 143 const extensions::Extension* extension =
144 LoadExtension(test_data_dir_.AppendASCII("push_messaging")); 144 LoadExtension(test_data_dir_.AppendASCII("push_messaging"));
145 ASSERT_TRUE(extension); 145 ASSERT_TRUE(extension);
146 ui_test_utils::NavigateToURL( 146 ui_test_utils::NavigateToURL(
147 browser(), extension->GetResourceURL("get_channel_id.html")); 147 browser(), extension->GetResourceURL("get_channel_id.html"));
148 148
149 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 149 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
150 } 150 }
151 151
152 } // namespace extensions 152 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698