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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
7 #include "chrome/browser/download/download_prefs.h" | 7 #include "chrome/browser/download/download_prefs.h" |
8 #include "chrome/browser/extensions/event_router.h" | 8 #include "chrome/browser/extensions/event_router.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_info_map.h" | 10 #include "chrome/browser/extensions/extension_info_map.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen(); | 127 DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen(); |
128 manager->RemoveAllDownloads(); | 128 manager->RemoveAllDownloads(); |
129 } | 129 } |
130 | 130 |
131 // Sends onExecuteContentHandler event with the MIME type "test/done" to the | 131 // Sends onExecuteContentHandler event with the MIME type "test/done" to the |
132 // test extension. | 132 // test extension. |
133 // The test extension calls 'chrome.test.notifySuccess' when it receives the | 133 // The test extension calls 'chrome.test.notifySuccess' when it receives the |
134 // event with the "test/done" MIME type (unless the 'chrome.test.notifyFail' | 134 // event with the "test/done" MIME type (unless the 'chrome.test.notifyFail' |
135 // has already been called). | 135 // has already been called). |
136 void SendDoneEvent() { | 136 void SendDoneEvent() { |
137 scoped_ptr<ListValue> event_args(new ListValue()); | 137 scoped_ptr<base::ListValue> event_args(new base::ListValue()); |
138 event_args->Append(new base::StringValue("test/done")); | 138 event_args->Append(new base::StringValue("test/done")); |
139 event_args->Append(new base::StringValue("http://foo")); | 139 event_args->Append(new base::StringValue("http://foo")); |
140 event_args->Append(new base::StringValue("blob://bar")); | 140 event_args->Append(new base::StringValue("blob://bar")); |
141 event_args->Append(new base::FundamentalValue(10)); | 141 event_args->Append(new base::FundamentalValue(10)); |
142 event_args->Append(new base::FundamentalValue(20)); | 142 event_args->Append(new base::FundamentalValue(20)); |
143 | 143 |
144 scoped_ptr<Event> event(new Event( | 144 scoped_ptr<Event> event(new Event( |
145 "streamsPrivate.onExecuteMimeTypeHandler", event_args.Pass())); | 145 "streamsPrivate.onExecuteMimeTypeHandler", event_args.Pass())); |
146 | 146 |
147 ExtensionSystem::Get(browser()->profile())->event_router()-> | 147 ExtensionSystem::Get(browser()->profile())->event_router()-> |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // The test extension should not receive any events by now. Send it an event | 307 // The test extension should not receive any events by now. Send it an event |
308 // with MIME type "test/done", so it stops waiting for the events. (If there | 308 // with MIME type "test/done", so it stops waiting for the events. (If there |
309 // was an event with MIME type 'plain/text', |catcher.GetNextResult()| will | 309 // was an event with MIME type 'plain/text', |catcher.GetNextResult()| will |
310 // fail regardless of the sent event; chrome.test.notifySuccess will not be | 310 // fail regardless of the sent event; chrome.test.notifySuccess will not be |
311 // called by the extension). | 311 // called by the extension). |
312 SendDoneEvent(); | 312 SendDoneEvent(); |
313 EXPECT_TRUE(catcher.GetNextResult()); | 313 EXPECT_TRUE(catcher.GetNextResult()); |
314 } | 314 } |
315 | 315 |
316 } // namespace | 316 } // namespace |
OLD | NEW |