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

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

Issue 10828087: Add skeleton implementation of ExtensionPushMessagingEventRouter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing #include Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h"
6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_test_message_listener.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/base/ui_test_utils.h"
13
14 namespace extensions {
15
16 class PushMessagingApiTest : public ExtensionApiTest {
17 public:
18 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
19 ExtensionApiTest::SetUpCommandLine(command_line);
20 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
21 }
22 };
23
24 IN_PROC_BROWSER_TEST_F(PushMessagingApiTest, EventDispatch) {
25 ResultCatcher catcher;
26 catcher.RestrictToProfile(browser()->profile());
27
28 ExtensionTestMessageListener ready("ready", true);
29 const extensions::Extension* extension =
30 LoadExtension(test_data_dir_.AppendASCII("push_messaging"));
31 ASSERT_TRUE(extension);
32 GURL page_url = extension->GetResourceURL("event_dispatch.html");
33 ui_test_utils::NavigateToURL(browser(), page_url);
34 EXPECT_TRUE(ready.WaitUntilSatisfied());
35
36 // Trigger a callback.
37 browser()->profile()->GetExtensionService()->
38 push_messaging_event_router()->OnMessage(
39 extension->id(), 1, "payload");
40
41 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
42 }
43
44 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/push_messaging/push_messaging_api.cc ('k') | chrome/browser/extensions/event_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698