| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ntp_snippets/download_suggestions_provider.h" | 5 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 result.push_back(CreateDummyOfflinePage(id)); | 146 result.push_back(CreateDummyOfflinePage(id)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 return result; | 149 return result; |
| 150 } | 150 } |
| 151 | 151 |
| 152 std::unique_ptr<FakeDownloadItem> CreateDummyAssetDownload(int id) { | 152 std::unique_ptr<FakeDownloadItem> CreateDummyAssetDownload(int id) { |
| 153 std::unique_ptr<FakeDownloadItem> item = base::MakeUnique<FakeDownloadItem>(); | 153 std::unique_ptr<FakeDownloadItem> item = base::MakeUnique<FakeDownloadItem>(); |
| 154 item->SetId(id); | 154 item->SetId(id); |
| 155 std::string id_string = base::IntToString(id); | 155 std::string id_string = base::IntToString(id); |
| 156 item->SetGuid("XYZ-100032-EFZBDF-13323-PXZ" + id_string); |
| 156 item->SetTargetFilePath( | 157 item->SetTargetFilePath( |
| 157 base::FilePath::FromUTF8Unsafe("folder/file" + id_string + ".mhtml")); | 158 base::FilePath::FromUTF8Unsafe("folder/file" + id_string + ".mhtml")); |
| 158 item->SetURL(GURL("http://download.com/redirected" + id_string)); | 159 item->SetURL(GURL("http://download.com/redirected" + id_string)); |
| 159 item->SetOriginalUrl(GURL("http://download.com/" + id_string)); | 160 item->SetOriginalUrl(GURL("http://download.com/" + id_string)); |
| 160 item->SetStartTime(base::Time::Now()); | 161 item->SetStartTime(base::Time::Now()); |
| 161 item->SetFileExternallyRemoved(false); | 162 item->SetFileExternallyRemoved(false); |
| 162 item->SetState(DownloadItem::DownloadState::COMPLETE); | 163 item->SetState(DownloadItem::DownloadState::COMPLETE); |
| 163 item->SetMimeType("application/pdf"); | 164 item->SetMimeType("application/pdf"); |
| 164 return item; | 165 return item; |
| 165 } | 166 } |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 // it has been visited recently. | 1108 // it has been visited recently. |
| 1108 EXPECT_CALL( | 1109 EXPECT_CALL( |
| 1109 *observer(), | 1110 *observer(), |
| 1110 OnNewSuggestions(_, downloads_category(), | 1111 OnNewSuggestions(_, downloads_category(), |
| 1111 UnorderedElementsAre(HasUrl("http://dummy.com/0")))); | 1112 UnorderedElementsAre(HasUrl("http://dummy.com/0")))); |
| 1112 auto test_clock = base::MakeUnique<base::SimpleTestClock>(); | 1113 auto test_clock = base::MakeUnique<base::SimpleTestClock>(); |
| 1113 test_clock->SetNow(now); | 1114 test_clock->SetNow(now); |
| 1114 CreateProvider(/*show_assets=*/false, /*show_offline_pages=*/true, | 1115 CreateProvider(/*show_assets=*/false, /*show_offline_pages=*/true, |
| 1115 std::move(test_clock)); | 1116 std::move(test_clock)); |
| 1116 } | 1117 } |
| OLD | NEW |