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