| 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 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 last_non_binary_download, run_loop.QuitClosure()))); | 258 last_non_binary_download, run_loop.QuitClosure()))); |
| 259 | 259 |
| 260 if (finder) | 260 if (finder) |
| 261 run_loop.Run(); | 261 run_loop.Run(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 history::DownloadRow CreateTestDownloadRow( | 264 history::DownloadRow CreateTestDownloadRow( |
| 265 const base::FilePath::CharType* file_path) { | 265 const base::FilePath::CharType* file_path) { |
| 266 base::Time now(base::Time::Now()); | 266 base::Time now(base::Time::Now()); |
| 267 return history::DownloadRow( | 267 return history::DownloadRow( |
| 268 base::FilePath(file_path), | 268 base::FilePath(file_path), base::FilePath(file_path), |
| 269 base::FilePath(file_path), | |
| 270 std::vector<GURL>(1, GURL("http://www.google.com")), // url_chain | 269 std::vector<GURL>(1, GURL("http://www.google.com")), // url_chain |
| 271 GURL(), // referrer | 270 GURL("http://referrer.example.com/"), // referrer |
| 272 std::string(), // HTTP method | 271 GURL("http://tab-url.example.com/"), // tab URL |
| 273 "application/octet-stream", // mime_type | 272 GURL("http://tab-referrer.example.com/"), // tab referrer URL |
| 273 std::string(), // HTTP method |
| 274 "application/octet-stream", // mime_type |
| 274 "application/octet-stream", // original_mime_type | 275 "application/octet-stream", // original_mime_type |
| 275 now - base::TimeDelta::FromMinutes(10), // start | 276 now - base::TimeDelta::FromMinutes(10), // start |
| 276 now - base::TimeDelta::FromMinutes(9), // end | 277 now - base::TimeDelta::FromMinutes(9), // end |
| 277 std::string(), // etag | 278 std::string(), // etag |
| 278 std::string(), // last_modified | 279 std::string(), // last_modified |
| 279 47LL, // received | 280 47LL, // received |
| 280 47LL, // total | 281 47LL, // total |
| 281 history::DownloadState::COMPLETE, // download_state | 282 history::DownloadState::COMPLETE, // download_state |
| 282 history::DownloadDangerType::NOT_DANGEROUS, // danger_type | 283 history::DownloadDangerType::NOT_DANGEROUS, // danger_type |
| 283 history::ToHistoryDownloadInterruptReason( | 284 history::ToHistoryDownloadInterruptReason( |
| 284 content::DOWNLOAD_INTERRUPT_REASON_NONE), // interrupt_reason, | 285 content::DOWNLOAD_INTERRUPT_REASON_NONE), // interrupt_reason, |
| 285 std::string(), // hash | 286 std::string(), // hash |
| 286 download_id_++, // id | 287 download_id_++, // id |
| 287 base::GenerateGUID(), | 288 base::GenerateGUID(), // GUID |
| 288 false, // download_opened | 289 false, // download_opened |
| 289 std::string(), // ext_id | 290 std::string(), // ext_id |
| 290 std::string()); // ext_name | 291 std::string()); // ext_name |
| 291 } | 292 } |
| 292 | 293 |
| 293 content::TestBrowserThreadBundle browser_thread_bundle_; | 294 content::TestBrowserThreadBundle browser_thread_bundle_; |
| 294 scoped_ptr<TestingProfileManager> profile_manager_; | 295 scoped_ptr<TestingProfileManager> profile_manager_; |
| 295 | 296 |
| 296 private: | 297 private: |
| 297 // A HistoryService::DownloadCreateCallback that asserts that the download was | 298 // A HistoryService::DownloadCreateCallback that asserts that the download was |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 base::Bind(&LastDownloadFinderTest::OnLastDownload, | 456 base::Bind(&LastDownloadFinderTest::OnLastDownload, |
| 456 base::Unretained(this), &last_binary_download, | 457 base::Unretained(this), &last_binary_download, |
| 457 &last_non_binary_download, run_loop.QuitClosure()))); | 458 &last_non_binary_download, run_loop.QuitClosure()))); |
| 458 | 459 |
| 459 run_loop.Run(); | 460 run_loop.Run(); |
| 460 | 461 |
| 461 ASSERT_TRUE(last_binary_download); | 462 ASSERT_TRUE(last_binary_download); |
| 462 } | 463 } |
| 463 | 464 |
| 464 } // namespace safe_browsing | 465 } // namespace safe_browsing |
| OLD | NEW |