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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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), base::FilePath(file_path), | 274 base::FilePath(file_path), base::FilePath(file_path), |
275 std::vector<GURL>(1, GURL("http://www.google.com")), // url_chain | 275 std::vector<GURL>(1, GURL("http://www.google.com")), // url_chain |
276 GURL("http://referrer.example.com/"), // referrer | 276 GURL("http://referrer.example.com/"), // referrer |
| 277 GURL("http://site-url.example.com/"), // site instance URL |
277 GURL("http://tab-url.example.com/"), // tab URL | 278 GURL("http://tab-url.example.com/"), // tab URL |
278 GURL("http://tab-referrer.example.com/"), // tab referrer URL | 279 GURL("http://tab-referrer.example.com/"), // tab referrer URL |
279 std::string(), // HTTP method | 280 std::string(), // HTTP method |
280 "application/octet-stream", // mime_type | 281 "application/octet-stream", // mime_type |
281 "application/octet-stream", // original_mime_type | 282 "application/octet-stream", // original_mime_type |
282 now - base::TimeDelta::FromMinutes(10), // start | 283 now - base::TimeDelta::FromMinutes(10), // start |
283 now - base::TimeDelta::FromMinutes(9), // end | 284 now - base::TimeDelta::FromMinutes(9), // end |
284 std::string(), // etag | 285 std::string(), // etag |
285 std::string(), // last_modified | 286 std::string(), // last_modified |
286 47LL, // received | 287 47LL, // received |
287 47LL, // total | 288 47LL, // total |
288 history::DownloadState::COMPLETE, // download_state | 289 history::DownloadState::COMPLETE, // download_state |
289 history::DownloadDangerType::NOT_DANGEROUS, // danger_type | 290 history::DownloadDangerType::NOT_DANGEROUS, // danger_type |
290 history::ToHistoryDownloadInterruptReason( | 291 history::ToHistoryDownloadInterruptReason( |
291 content::DOWNLOAD_INTERRUPT_REASON_NONE), // interrupt_reason, | 292 content::DOWNLOAD_INTERRUPT_REASON_NONE), // interrupt_reason, |
292 std::string(), // hash | 293 std::string(), // hash |
293 download_id_++, // id | 294 download_id_++, // id |
294 base::GenerateGUID(), // GUID | 295 base::GenerateGUID(), // GUID |
295 false, // download_opened | 296 false, // download_opened |
296 std::string(), // ext_id | 297 std::string(), // ext_id |
297 std::string()); // ext_name | 298 std::string()); // ext_name |
298 } | 299 } |
299 | 300 |
300 content::TestBrowserThreadBundle browser_thread_bundle_; | 301 content::TestBrowserThreadBundle browser_thread_bundle_; |
301 std::unique_ptr<TestingProfileManager> profile_manager_; | 302 std::unique_ptr<TestingProfileManager> profile_manager_; |
302 | 303 |
303 private: | 304 private: |
304 // A HistoryService::DownloadCreateCallback that asserts that the download was | 305 // A HistoryService::DownloadCreateCallback that asserts that the download was |
305 // created and runs |closure|. | 306 // created and runs |closure|. |
306 void ContinueOnDownloadCreated(const base::Closure& closure, bool created) { | 307 void ContinueOnDownloadCreated(const base::Closure& closure, bool created) { |
307 ASSERT_TRUE(created); | 308 ASSERT_TRUE(created); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 base::Bind(&LastDownloadFinderTest::OnLastDownload, | 463 base::Bind(&LastDownloadFinderTest::OnLastDownload, |
463 base::Unretained(this), &last_binary_download, | 464 base::Unretained(this), &last_binary_download, |
464 &last_non_binary_download, run_loop.QuitClosure()))); | 465 &last_non_binary_download, run_loop.QuitClosure()))); |
465 | 466 |
466 run_loop.Run(); | 467 run_loop.Run(); |
467 | 468 |
468 ASSERT_TRUE(last_binary_download); | 469 ASSERT_TRUE(last_binary_download); |
469 } | 470 } |
470 | 471 |
471 } // namespace safe_browsing | 472 } // namespace safe_browsing |
OLD | NEW |