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

Side by Side Diff: chrome/browser/extensions/extension_messages_apitest.cc

Issue 10661038: Revert 143896 - Filtered events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
Property Changes:
Added: svn:mergeinfo
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/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/browser/extensions/extension_event_router.h" 6 #include "chrome/browser/extensions/extension_event_router.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/common/chrome_notification_types.h" 8 #include "chrome/common/chrome_notification_types.h"
9 #include "content/public/browser/notification_registrar.h" 9 #include "content/public/browser/notification_registrar.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
(...skipping 13 matching lines...) Expand all
24 const content::NotificationSource& source, 24 const content::NotificationSource& source,
25 const content::NotificationDetails& details) { 25 const content::NotificationDetails& details) {
26 ExtensionEventRouter* event_router = 26 ExtensionEventRouter* event_router =
27 content::Source<Profile>(source).ptr()->GetExtensionEventRouter(); 27 content::Source<Profile>(source).ptr()->GetExtensionEventRouter();
28 28
29 // Sends four messages to the extension. All but the third message sent 29 // Sends four messages to the extension. All but the third message sent
30 // from the origin http://b.com/ are supposed to arrive. 30 // from the origin http://b.com/ are supposed to arrive.
31 event_router->DispatchEventToRenderers("test.onMessage", 31 event_router->DispatchEventToRenderers("test.onMessage",
32 "[{\"lastMessage\":false,\"data\":\"no restriction\"}]", 32 "[{\"lastMessage\":false,\"data\":\"no restriction\"}]",
33 content::Source<Profile>(source).ptr(), 33 content::Source<Profile>(source).ptr(),
34 GURL(), 34 GURL());
35 EventFilteringInfo());
36 event_router->DispatchEventToRenderers("test.onMessage", 35 event_router->DispatchEventToRenderers("test.onMessage",
37 "[{\"lastMessage\":false,\"data\":\"http://a.com/\"}]", 36 "[{\"lastMessage\":false,\"data\":\"http://a.com/\"}]",
38 content::Source<Profile>(source).ptr(), 37 content::Source<Profile>(source).ptr(),
39 GURL("http://a.com/"), 38 GURL("http://a.com/"));
40 EventFilteringInfo());
41 event_router->DispatchEventToRenderers("test.onMessage", 39 event_router->DispatchEventToRenderers("test.onMessage",
42 "[{\"lastMessage\":false,\"data\":\"http://b.com/\"}]", 40 "[{\"lastMessage\":false,\"data\":\"http://b.com/\"}]",
43 content::Source<Profile>(source).ptr(), 41 content::Source<Profile>(source).ptr(),
44 GURL("http://b.com/"), 42 GURL("http://b.com/"));
45 EventFilteringInfo());
46 event_router->DispatchEventToRenderers("test.onMessage", 43 event_router->DispatchEventToRenderers("test.onMessage",
47 "[{\"lastMessage\":true,\"data\":\"last message\"}]", 44 "[{\"lastMessage\":true,\"data\":\"last message\"}]",
48 content::Source<Profile>(source).ptr(), 45 content::Source<Profile>(source).ptr(),
49 GURL(), 46 GURL());
50 EventFilteringInfo());
51 } 47 }
52 48
53 content::NotificationRegistrar registrar_; 49 content::NotificationRegistrar registrar_;
54 }; 50 };
55 51
56 } // namespace 52 } // namespace
57 53
58 // Tests that message passing between extensions and content scripts works. 54 // Tests that message passing between extensions and content scripts works.
59 // Flaky on the trybots. See http://crbug.com/96725. 55 // Flaky on the trybots. See http://crbug.com/96725.
60 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Messaging) { 56 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Messaging) {
(...skipping 11 matching lines...) Expand all
72 68
73 ASSERT_TRUE(RunExtensionTest("messaging/connect_external")) << message_; 69 ASSERT_TRUE(RunExtensionTest("messaging/connect_external")) << message_;
74 } 70 }
75 71
76 // Tests that messages with event_urls are only passed to extensions with 72 // Tests that messages with event_urls are only passed to extensions with
77 // appropriate permissions. 73 // appropriate permissions.
78 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingEventURL) { 74 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingEventURL) {
79 MessageSender sender; 75 MessageSender sender;
80 ASSERT_TRUE(RunExtensionTest("messaging/event_url")) << message_; 76 ASSERT_TRUE(RunExtensionTest("messaging/event_url")) << message_;
81 } 77 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_api.cc ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698