| 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 "content/browser/download/download_item_impl.h" | 5 #include "content/browser/download/download_item_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "content/browser/download/download_destination_observer.h" | 21 #include "content/browser/download/download_destination_observer.h" |
| 22 #include "content/browser/download/download_file_factory.h" | 22 #include "content/browser/download/download_file_factory.h" |
| 23 #include "content/browser/download/download_item_impl_delegate.h" | 23 #include "content/browser/download/download_item_impl_delegate.h" |
| 24 #include "content/browser/download/download_request_handle.h" | 24 #include "content/browser/download/download_request_handle.h" |
| 25 #include "content/browser/download/mock_download_file.h" | 25 #include "content/browser/download/mock_download_file.h" |
| 26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/download_interrupt_reasons.h" | 27 #include "content/public/browser/download_interrupt_reasons.h" |
| 28 #include "content/public/browser/download_url_parameters.h" | 28 #include "content/public/browser/download_url_parameters.h" |
| 29 #include "content/public/common/content_features.h" | 29 #include "content/public/common/content_features.h" |
| 30 #include "content/public/test/mock_download_item.h" | 30 #include "content/public/test/mock_download_item.h" |
| 31 #include "content/public/test/mock_download_item.h" | |
| 32 #include "content/public/test/test_browser_context.h" | |
| 33 #include "content/public/test/test_browser_context.h" | 31 #include "content/public/test/test_browser_context.h" |
| 34 #include "content/public/test/test_browser_thread_bundle.h" | 32 #include "content/public/test/test_browser_thread_bundle.h" |
| 35 #include "content/public/test/web_contents_tester.h" | 33 #include "content/public/test/web_contents_tester.h" |
| 36 #include "crypto/secure_hash.h" | 34 #include "crypto/secure_hash.h" |
| 37 #include "testing/gmock/include/gmock/gmock.h" | 35 #include "testing/gmock/include/gmock/gmock.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 39 | 37 |
| 40 using ::testing::DoAll; | 38 using ::testing::DoAll; |
| 41 using ::testing::NiceMock; | 39 using ::testing::NiceMock; |
| 42 using ::testing::Property; | 40 using ::testing::Property; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 void OnDownloadFileAcquired(base::FilePath* return_path, | 393 void OnDownloadFileAcquired(base::FilePath* return_path, |
| 396 const base::FilePath& path) { | 394 const base::FilePath& path) { |
| 397 *return_path = path; | 395 *return_path = path; |
| 398 } | 396 } |
| 399 | 397 |
| 400 DownloadCreateInfo* create_info() { return create_info_.get(); } | 398 DownloadCreateInfo* create_info() { return create_info_.get(); } |
| 401 | 399 |
| 402 BrowserContext* browser_context() { return &browser_context_; } | 400 BrowserContext* browser_context() { return &browser_context_; } |
| 403 | 401 |
| 404 private: | 402 private: |
| 403 TestBrowserThreadBundle thread_bundle_; |
| 405 StrictMock<MockDelegate> delegate_; | 404 StrictMock<MockDelegate> delegate_; |
| 406 std::set<DownloadItem*> allocated_downloads_; | 405 std::set<DownloadItem*> allocated_downloads_; |
| 407 scoped_ptr<DownloadCreateInfo> create_info_; | 406 scoped_ptr<DownloadCreateInfo> create_info_; |
| 408 uint32_t next_download_id_ = DownloadItem::kInvalidId + 1; | 407 uint32_t next_download_id_ = DownloadItem::kInvalidId + 1; |
| 409 TestBrowserContext browser_context_; | 408 TestBrowserContext browser_context_; |
| 410 TestBrowserThreadBundle thread_bundle_; | |
| 411 }; | 409 }; |
| 412 | 410 |
| 413 // Tests to ensure calls that change a DownloadItem generate an update to | 411 // Tests to ensure calls that change a DownloadItem generate an update to |
| 414 // observers. | 412 // observers. |
| 415 // State changing functions not tested: | 413 // State changing functions not tested: |
| 416 // void OpenDownload(); | 414 // void OpenDownload(); |
| 417 // void ShowDownloadInShell(); | 415 // void ShowDownloadInShell(); |
| 418 // void CompleteDelayedDownload(); | 416 // void CompleteDelayedDownload(); |
| 419 // set_* mutators | 417 // set_* mutators |
| 420 | 418 |
| (...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 | 2041 |
| 2044 item_->Cancel(true); | 2042 item_->Cancel(true); |
| 2045 RunAllPendingInMessageLoops(); | 2043 RunAllPendingInMessageLoops(); |
| 2046 } | 2044 } |
| 2047 | 2045 |
| 2048 TEST(MockDownloadItem, Compiles) { | 2046 TEST(MockDownloadItem, Compiles) { |
| 2049 MockDownloadItem mock_item; | 2047 MockDownloadItem mock_item; |
| 2050 } | 2048 } |
| 2051 | 2049 |
| 2052 } // namespace content | 2050 } // namespace content |
| OLD | NEW |