| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 EXPECT_TRUE(download_manager); | 179 EXPECT_TRUE(download_manager); |
| 180 return download_manager; | 180 return download_manager; |
| 181 } | 181 } |
| 182 | 182 |
| 183 // Deletes the download and waits until it's flushed. | 183 // Deletes the download and waits until it's flushed. |
| 184 // The |manager| should have |download| in its list of downloads. | 184 // The |manager| should have |download| in its list of downloads. |
| 185 void DeleteDownloadAndWaitForFlush(DownloadItem* download, | 185 void DeleteDownloadAndWaitForFlush(DownloadItem* download, |
| 186 DownloadManager* manager) { | 186 DownloadManager* manager) { |
| 187 scoped_refptr<content::DownloadTestFlushObserver> flush_observer( | 187 scoped_refptr<content::DownloadTestFlushObserver> flush_observer( |
| 188 new content::DownloadTestFlushObserver(manager)); | 188 new content::DownloadTestFlushObserver(manager)); |
| 189 download->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 189 download->Remove(); |
| 190 flush_observer->WaitForFlush(); | 190 flush_observer->WaitForFlush(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 protected: | 193 protected: |
| 194 std::string test_extension_id_; | 194 std::string test_extension_id_; |
| 195 // The HTTP server used in the tests. | 195 // The HTTP server used in the tests. |
| 196 scoped_ptr<EmbeddedTestServer> test_server_; | 196 scoped_ptr<EmbeddedTestServer> test_server_; |
| 197 base::ScopedTempDir downloads_dir_; | 197 base::ScopedTempDir downloads_dir_; |
| 198 }; | 198 }; |
| 199 | 199 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 // The test extension should not receive any events by now. Send it an event | 306 // The test extension should not receive any events by now. Send it an event |
| 307 // with MIME type "test/done", so it stops waiting for the events. (If there | 307 // with MIME type "test/done", so it stops waiting for the events. (If there |
| 308 // was an event with MIME type 'plain/text', |catcher.GetNextResult()| will | 308 // was an event with MIME type 'plain/text', |catcher.GetNextResult()| will |
| 309 // fail regardless of the sent event; chrome.test.notifySuccess will not be | 309 // fail regardless of the sent event; chrome.test.notifySuccess will not be |
| 310 // called by the extension). | 310 // called by the extension). |
| 311 SendDoneEvent(); | 311 SendDoneEvent(); |
| 312 EXPECT_TRUE(catcher.GetNextResult()); | 312 EXPECT_TRUE(catcher.GetNextResult()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace | 315 } // namespace |
| OLD | NEW |