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

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

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 3 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_message_service.h" 6 #include "chrome/browser/extensions/extension_message_service.h"
7 #include "chrome/browser/profile.h" 7 #include "chrome/browser/profile.h"
8 #include "chrome/common/notification_registrar.h" 8 #include "chrome/common/notification_registrar.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 10
(...skipping 10 matching lines...) Expand all
21 virtual void Observe(NotificationType type, 21 virtual void Observe(NotificationType type,
22 const NotificationSource& source, 22 const NotificationSource& source,
23 const NotificationDetails& details) { 23 const NotificationDetails& details) {
24 ExtensionMessageService* message_service = 24 ExtensionMessageService* message_service =
25 Source<Profile>(source).ptr()->GetExtensionMessageService(); 25 Source<Profile>(source).ptr()->GetExtensionMessageService();
26 26
27 // Sends four messages to the extension. All but the third message sent 27 // Sends four messages to the extension. All but the third message sent
28 // from the origin http://b.com/ are supposed to arrive. 28 // from the origin http://b.com/ are supposed to arrive.
29 message_service->DispatchEventToRenderers("test.onMessage", 29 message_service->DispatchEventToRenderers("test.onMessage",
30 "[{\"lastMessage\":false,\"data\":\"no restriction\"}]", 30 "[{\"lastMessage\":false,\"data\":\"no restriction\"}]",
31 Source<Profile>(source).ptr()->IsOffTheRecord(), 31 Source<Profile>(source).ptr(),
32 GURL()); 32 GURL());
33 message_service->DispatchEventToRenderers("test.onMessage", 33 message_service->DispatchEventToRenderers("test.onMessage",
34 "[{\"lastMessage\":false,\"data\":\"http://a.com/\"}]", 34 "[{\"lastMessage\":false,\"data\":\"http://a.com/\"}]",
35 Source<Profile>(source).ptr()->IsOffTheRecord(), 35 Source<Profile>(source).ptr(),
36 GURL("http://a.com/")); 36 GURL("http://a.com/"));
37 message_service->DispatchEventToRenderers("test.onMessage", 37 message_service->DispatchEventToRenderers("test.onMessage",
38 "[{\"lastMessage\":false,\"data\":\"http://b.com/\"}]", 38 "[{\"lastMessage\":false,\"data\":\"http://b.com/\"}]",
39 Source<Profile>(source).ptr()->IsOffTheRecord(), 39 Source<Profile>(source).ptr(),
40 GURL("http://b.com/")); 40 GURL("http://b.com/"));
41 message_service->DispatchEventToRenderers("test.onMessage", 41 message_service->DispatchEventToRenderers("test.onMessage",
42 "[{\"lastMessage\":true,\"data\":\"last message\"}]", 42 "[{\"lastMessage\":true,\"data\":\"last message\"}]",
43 Source<Profile>(source).ptr()->IsOffTheRecord(), 43 Source<Profile>(source).ptr(),
44 GURL()); 44 GURL());
45 } 45 }
46 46
47 NotificationRegistrar registrar_; 47 NotificationRegistrar registrar_;
48 }; 48 };
49 49
50 } // namespace 50 } // namespace
51 51
52 // Tests that message passing between extensions and content scripts works. 52 // Tests that message passing between extensions and content scripts works.
53 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Messaging) { 53 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Messaging) {
(...skipping 11 matching lines...) Expand all
65 65
66 ASSERT_TRUE(RunExtensionTest("messaging/connect_external")) << message_; 66 ASSERT_TRUE(RunExtensionTest("messaging/connect_external")) << message_;
67 } 67 }
68 68
69 // Tests that messages with event_urls are only passed to extensions with 69 // Tests that messages with event_urls are only passed to extensions with
70 // appropriate permissions. 70 // appropriate permissions.
71 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingEventURL) { 71 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingEventURL) {
72 MessageSender sender; 72 MessageSender sender;
73 ASSERT_TRUE(RunExtensionTest("messaging/event_url")) << message_; 73 ASSERT_TRUE(RunExtensionTest("messaging/event_url")) << message_;
74 } 74 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_message_service.cc ('k') | chrome/browser/extensions/extension_omnibox_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698