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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/download/download_prefs.h" | 8 #include "chrome/browser/download/download_prefs.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 info.mime_type = "test/done"; | 167 info.mime_type = "test/done"; |
168 info.original_url = "http://foo"; | 168 info.original_url = "http://foo"; |
169 info.stream_url = "blob://bar"; | 169 info.stream_url = "blob://bar"; |
170 info.tab_id = 10; | 170 info.tab_id = 10; |
171 info.expected_content_size = 20; | 171 info.expected_content_size = 20; |
172 | 172 |
173 scoped_ptr<Event> event( | 173 scoped_ptr<Event> event( |
174 new Event(streams_private::OnExecuteMimeTypeHandler::kEventName, | 174 new Event(streams_private::OnExecuteMimeTypeHandler::kEventName, |
175 streams_private::OnExecuteMimeTypeHandler::Create(info))); | 175 streams_private::OnExecuteMimeTypeHandler::Create(info))); |
176 | 176 |
177 ExtensionSystem::Get(browser()->profile())->event_router()-> | 177 extensions::EventRouter::Get(browser()->profile()) |
178 DispatchEventToExtension(test_extension_id_, event.Pass()); | 178 ->DispatchEventToExtension(test_extension_id_, event.Pass()); |
179 } | 179 } |
180 | 180 |
181 // Loads the test extension and set's up its file_browser_handler to handle | 181 // Loads the test extension and set's up its file_browser_handler to handle |
182 // 'application/msword' and 'text/plain' MIME types. | 182 // 'application/msword' and 'text/plain' MIME types. |
183 // The extension will notify success when it detects an event with the MIME | 183 // The extension will notify success when it detects an event with the MIME |
184 // type 'application/msword' and notify fail when it detects an event with the | 184 // type 'application/msword' and notify fail when it detects an event with the |
185 // MIME type 'text/plain'. | 185 // MIME type 'text/plain'. |
186 const extensions::Extension* LoadTestExtension() { | 186 const extensions::Extension* LoadTestExtension() { |
187 // The test extension id is set by the key value in the manifest. | 187 // The test extension id is set by the key value in the manifest. |
188 test_extension_id_ = "oickdpebdnfbgkcaoklfcdhjniefkcji"; | 188 test_extension_id_ = "oickdpebdnfbgkcaoklfcdhjniefkcji"; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 std::vector<DownloadItem*> downloads; | 415 std::vector<DownloadItem*> downloads; |
416 download_manager->GetAllDownloads(&downloads); | 416 download_manager->GetAllDownloads(&downloads); |
417 ASSERT_EQ(0u, downloads.size()); | 417 ASSERT_EQ(0u, downloads.size()); |
418 | 418 |
419 // The test extension should receive onExecuteContentHandler event with MIME | 419 // The test extension should receive onExecuteContentHandler event with MIME |
420 // type 'application/msexcel' (and call chrome.test.notifySuccess). | 420 // type 'application/msexcel' (and call chrome.test.notifySuccess). |
421 EXPECT_TRUE(catcher.GetNextResult()); | 421 EXPECT_TRUE(catcher.GetNextResult()); |
422 } | 422 } |
423 | 423 |
424 } // namespace | 424 } // namespace |
OLD | NEW |