OLD | NEW |
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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 GURL event_url) { | 65 GURL event_url) { |
66 scoped_ptr<Event> event(new Event("test.onMessage", event_args.Pass())); | 66 scoped_ptr<Event> event(new Event("test.onMessage", event_args.Pass())); |
67 event->restrict_to_browser_context = profile; | 67 event->restrict_to_browser_context = profile; |
68 event->event_url = event_url; | 68 event->event_url = event_url; |
69 return event.Pass(); | 69 return event.Pass(); |
70 } | 70 } |
71 | 71 |
72 virtual void Observe(int type, | 72 virtual void Observe(int type, |
73 const content::NotificationSource& source, | 73 const content::NotificationSource& source, |
74 const content::NotificationDetails& details) OVERRIDE { | 74 const content::NotificationDetails& details) OVERRIDE { |
75 EventRouter* event_router = ExtensionSystem::Get( | 75 EventRouter* event_router = |
76 content::Source<Profile>(source).ptr())->event_router(); | 76 EventRouter::Get(content::Source<Profile>(source).ptr()); |
77 | 77 |
78 // Sends four messages to the extension. All but the third message sent | 78 // Sends four messages to the extension. All but the third message sent |
79 // from the origin http://b.com/ are supposed to arrive. | 79 // from the origin http://b.com/ are supposed to arrive. |
80 event_router->BroadcastEvent(BuildEvent( | 80 event_router->BroadcastEvent(BuildEvent( |
81 BuildEventArguments(false, "no restriction"), | 81 BuildEventArguments(false, "no restriction"), |
82 content::Source<Profile>(source).ptr(), | 82 content::Source<Profile>(source).ptr(), |
83 GURL())); | 83 GURL())); |
84 event_router->BroadcastEvent(BuildEvent( | 84 event_router->BroadcastEvent(BuildEvent( |
85 BuildEventArguments(false, "http://a.com/"), | 85 BuildEventArguments(false, "http://a.com/"), |
86 content::Source<Profile>(source).ptr(), | 86 content::Source<Profile>(source).ptr(), |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); | 965 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); |
966 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR , | 966 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR , |
967 CanConnectAndSendMessagesToMainFrame("invalid")); | 967 CanConnectAndSendMessagesToMainFrame("invalid")); |
968 } | 968 } |
969 | 969 |
970 #endif // !defined(OS_WIN) - http://crbug.com/350517. | 970 #endif // !defined(OS_WIN) - http://crbug.com/350517. |
971 | 971 |
972 } // namespace | 972 } // namespace |
973 | 973 |
974 }; // namespace extensions | 974 }; // namespace extensions |
OLD | NEW |