OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/safe_browsing/incident_reporting/last_download_finder.h
" | 5 #include "chrome/browser/safe_browsing/incident_reporting/last_download_finder.h
" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 last_non_binary_download, run_loop.QuitClosure()))); | 264 last_non_binary_download, run_loop.QuitClosure()))); |
265 | 265 |
266 if (finder) | 266 if (finder) |
267 run_loop.Run(); | 267 run_loop.Run(); |
268 } | 268 } |
269 | 269 |
270 history::DownloadRow CreateTestDownloadRow( | 270 history::DownloadRow CreateTestDownloadRow( |
271 const base::FilePath::CharType* file_path) { | 271 const base::FilePath::CharType* file_path) { |
272 base::Time now(base::Time::Now()); | 272 base::Time now(base::Time::Now()); |
273 return history::DownloadRow( | 273 return history::DownloadRow( |
274 base::FilePath(file_path), | 274 base::FilePath(file_path), base::FilePath(file_path), |
275 base::FilePath(file_path), | |
276 std::vector<GURL>(1, GURL("http://www.google.com")), // url_chain | 275 std::vector<GURL>(1, GURL("http://www.google.com")), // url_chain |
277 GURL(), // referrer | 276 GURL("http://referrer.example.com/"), // referrer |
278 std::string(), // HTTP method | 277 GURL("http://tab-url.example.com/"), // tab URL |
279 "application/octet-stream", // mime_type | 278 GURL("http://tab-referrer.example.com/"), // tab referrer URL |
| 279 std::string(), // HTTP method |
| 280 "application/octet-stream", // mime_type |
280 "application/octet-stream", // original_mime_type | 281 "application/octet-stream", // original_mime_type |
281 now - base::TimeDelta::FromMinutes(10), // start | 282 now - base::TimeDelta::FromMinutes(10), // start |
282 now - base::TimeDelta::FromMinutes(9), // end | 283 now - base::TimeDelta::FromMinutes(9), // end |
283 std::string(), // etag | 284 std::string(), // etag |
284 std::string(), // last_modified | 285 std::string(), // last_modified |
285 47LL, // received | 286 47LL, // received |
286 47LL, // total | 287 47LL, // total |
287 history::DownloadState::COMPLETE, // download_state | 288 history::DownloadState::COMPLETE, // download_state |
288 history::DownloadDangerType::NOT_DANGEROUS, // danger_type | 289 history::DownloadDangerType::NOT_DANGEROUS, // danger_type |
289 history::ToHistoryDownloadInterruptReason( | 290 history::ToHistoryDownloadInterruptReason( |
290 content::DOWNLOAD_INTERRUPT_REASON_NONE), // interrupt_reason, | 291 content::DOWNLOAD_INTERRUPT_REASON_NONE), // interrupt_reason, |
291 std::string(), // hash | 292 std::string(), // hash |
292 download_id_++, // id | 293 download_id_++, // id |
293 base::GenerateGUID(), | 294 base::GenerateGUID(), // GUID |
294 false, // download_opened | 295 false, // download_opened |
295 std::string(), // ext_id | 296 std::string(), // ext_id |
296 std::string()); // ext_name | 297 std::string()); // ext_name |
297 } | 298 } |
298 | 299 |
299 content::TestBrowserThreadBundle browser_thread_bundle_; | 300 content::TestBrowserThreadBundle browser_thread_bundle_; |
300 std::unique_ptr<TestingProfileManager> profile_manager_; | 301 std::unique_ptr<TestingProfileManager> profile_manager_; |
301 | 302 |
302 private: | 303 private: |
303 // A HistoryService::DownloadCreateCallback that asserts that the download was | 304 // A HistoryService::DownloadCreateCallback that asserts that the download was |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 base::Bind(&LastDownloadFinderTest::OnLastDownload, | 462 base::Bind(&LastDownloadFinderTest::OnLastDownload, |
462 base::Unretained(this), &last_binary_download, | 463 base::Unretained(this), &last_binary_download, |
463 &last_non_binary_download, run_loop.QuitClosure()))); | 464 &last_non_binary_download, run_loop.QuitClosure()))); |
464 | 465 |
465 run_loop.Run(); | 466 run_loop.Run(); |
466 | 467 |
467 ASSERT_TRUE(last_binary_download); | 468 ASSERT_TRUE(last_binary_download); |
468 } | 469 } |
469 | 470 |
470 } // namespace safe_browsing | 471 } // namespace safe_browsing |
OLD | NEW |