OLD | NEW |
---|---|
(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 ExtensionPushMessagingApiTest : public ExtensionApiTest { | |
Mihai Parparita -not on Chrome
2012/08/01 20:05:50
Can remove the "Extensions" prefix here too.
dcheng
2012/08/01 21:15:33
Done.
| |
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 | |
Mihai Parparita -not on Chrome
2012/08/01 20:05:50
Nit: extra newline.
dcheng
2012/08/01 21:15:33
Done.
| |
25 IN_PROC_BROWSER_TEST_F(ExtensionPushMessagingApiTest, EventDispatch) { | |
26 ResultCatcher catcher; | |
27 catcher.RestrictToProfile(browser()->profile()); | |
28 | |
29 ExtensionTestMessageListener ready("ready", true); | |
30 const extensions::Extension* extension = | |
31 LoadExtension(test_data_dir_.AppendASCII("push_messaging")); | |
32 ASSERT_TRUE(extension); | |
33 GURL page_url = extension->GetResourceURL("event_dispatch.html"); | |
34 ui_test_utils::NavigateToURL(browser(), page_url); | |
35 EXPECT_TRUE(ready.WaitUntilSatisfied()); | |
36 | |
37 // Trigger a callback. | |
38 browser()->profile()->GetExtensionService()-> | |
39 push_messaging_event_router()->OnMessage( | |
40 extension->id(), 1, "payload"); | |
41 | |
42 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
43 } | |
44 | |
45 } // namespace extensions | |
OLD | NEW |