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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 std::string(), | 86 std::string(), |
87 0, | 87 0, |
88 0, | 88 0, |
89 DownloadItem::COMPLETE, | 89 DownloadItem::COMPLETE, |
90 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 90 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
91 DOWNLOAD_INTERRUPT_REASON_NONE, | 91 DOWNLOAD_INTERRUPT_REASON_NONE, |
92 false, | 92 false, |
93 net::BoundNetLog()) {} | 93 net::BoundNetLog()) {} |
94 virtual ~MockDownloadItemImpl() {} | 94 virtual ~MockDownloadItemImpl() {} |
95 | 95 |
96 MOCK_METHOD4(OnDownloadTargetDetermined, | 96 MOCK_METHOD5(OnDownloadTargetDetermined, |
97 void(const base::FilePath&, TargetDisposition, | 97 void(const base::FilePath&, TargetDisposition, |
98 DownloadDangerType, const base::FilePath&)); | 98 DownloadDangerType, const base::FilePath&, bool)); |
99 MOCK_METHOD1(AddObserver, void(DownloadItem::Observer*)); | 99 MOCK_METHOD1(AddObserver, void(DownloadItem::Observer*)); |
100 MOCK_METHOD1(RemoveObserver, void(DownloadItem::Observer*)); | 100 MOCK_METHOD1(RemoveObserver, void(DownloadItem::Observer*)); |
101 MOCK_METHOD0(UpdateObservers, void()); | 101 MOCK_METHOD0(UpdateObservers, void()); |
102 MOCK_METHOD0(CanShowInFolder, bool()); | 102 MOCK_METHOD0(CanShowInFolder, bool()); |
103 MOCK_METHOD0(CanOpenDownload, bool()); | 103 MOCK_METHOD0(CanOpenDownload, bool()); |
104 MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool()); | 104 MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool()); |
105 MOCK_METHOD0(OpenDownload, void()); | 105 MOCK_METHOD0(OpenDownload, void()); |
106 MOCK_METHOD0(ShowDownloadInShell, void()); | 106 MOCK_METHOD0(ShowDownloadInShell, void()); |
107 MOCK_METHOD0(ValidateDangerousDownload, void()); | 107 MOCK_METHOD0(ValidateDangerousDownload, void()); |
108 MOCK_METHOD1(StealDangerousDownload, void(const AcquireFileCallback&)); | 108 MOCK_METHOD1(StealDangerousDownload, void(const AcquireFileCallback&)); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 551 } |
552 | 552 |
553 MockDownloadManagerObserver& GetMockObserver() { | 553 MockDownloadManagerObserver& GetMockObserver() { |
554 return *observer_; | 554 return *observer_; |
555 } | 555 } |
556 | 556 |
557 void DownloadTargetDeterminedCallback( | 557 void DownloadTargetDeterminedCallback( |
558 const base::FilePath& target_path, | 558 const base::FilePath& target_path, |
559 DownloadItem::TargetDisposition disposition, | 559 DownloadItem::TargetDisposition disposition, |
560 DownloadDangerType danger_type, | 560 DownloadDangerType danger_type, |
561 const base::FilePath& intermediate_path) { | 561 const base::FilePath& intermediate_path, |
| 562 bool hide_file_extension) { |
562 callback_called_ = true; | 563 callback_called_ = true; |
563 target_path_ = target_path; | 564 target_path_ = target_path; |
564 target_disposition_ = disposition; | 565 target_disposition_ = disposition; |
565 danger_type_ = danger_type; | 566 danger_type_ = danger_type; |
566 intermediate_path_ = intermediate_path; | 567 intermediate_path_ = intermediate_path; |
567 } | 568 } |
568 | 569 |
569 void DetermineDownloadTarget(DownloadItemImpl* item) { | 570 void DetermineDownloadTarget(DownloadItemImpl* item) { |
570 download_manager_->DetermineDownloadTarget( | 571 download_manager_->DetermineDownloadTarget( |
571 item, base::Bind( | 572 item, base::Bind( |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 EXPECT_CALL(GetMockDownloadItem(0), Remove()); | 719 EXPECT_CALL(GetMockDownloadItem(0), Remove()); |
719 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); | 720 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); |
720 | 721 |
721 url::Origin origin_to_clear(download_urls_[0]); | 722 url::Origin origin_to_clear(download_urls_[0]); |
722 int remove_count = download_manager_->RemoveDownloadsByOriginAndTime( | 723 int remove_count = download_manager_->RemoveDownloadsByOriginAndTime( |
723 origin_to_clear, base::Time(), base::Time::Max()); | 724 origin_to_clear, base::Time(), base::Time::Max()); |
724 EXPECT_EQ(remove_count, 1); | 725 EXPECT_EQ(remove_count, 1); |
725 } | 726 } |
726 | 727 |
727 } // namespace content | 728 } // namespace content |
OLD | NEW |