OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 bool CreateHistoryDownloads(const HistoryDownloadInfo* history_info, | 355 bool CreateHistoryDownloads(const HistoryDownloadInfo* history_info, |
356 size_t count, | 356 size_t count, |
357 DownloadManager::DownloadVector* items) { | 357 DownloadManager::DownloadVector* items) { |
358 DownloadIdComparator download_id_comparator; | 358 DownloadIdComparator download_id_comparator; |
359 base::Time current = base::Time::Now(); | 359 base::Time current = base::Time::Now(); |
360 std::vector<DownloadPersistentStoreInfo> entries; | 360 std::vector<DownloadPersistentStoreInfo> entries; |
361 entries.reserve(count); | 361 entries.reserve(count); |
362 for (size_t i = 0; i < count; ++i) { | 362 for (size_t i = 0; i < count; ++i) { |
363 DownloadPersistentStoreInfo entry( | 363 DownloadPersistentStoreInfo entry( |
364 downloads_directory().Append(history_info[i].filename), | 364 downloads_directory().Append(history_info[i].filename), |
365 GURL(), GURL(), // URL, referrer | 365 downloads_directory().Append(history_info[i].filename), |
| 366 std::vector<GURL>(), GURL(), // URL Chain, referrer |
366 current, current, // start_time, end_time | 367 current, current, // start_time, end_time |
367 1, 1, // received_bytes, total_bytes | 368 1, 1, // received_bytes, total_bytes |
368 history_info[i].state, // state | 369 history_info[i].state, // state |
| 370 content::DOWNLOAD_INTERRUPT_REASON_NONE, |
369 i + 1, // db_handle | 371 i + 1, // db_handle |
370 false); // opened | 372 false); // opened |
371 entries.push_back(entry); | 373 entries.push_back(entry); |
372 } | 374 } |
373 GetOnRecordManager()->OnPersistentStoreQueryComplete(&entries); | 375 GetOnRecordManager()->OnPersistentStoreQueryComplete(&entries); |
374 GetOnRecordManager()->GetAllDownloads(items); | 376 GetOnRecordManager()->GetAllDownloads(items); |
375 EXPECT_EQ(count, items->size()); | 377 EXPECT_EQ(count, items->size()); |
376 if (count != items->size()) | 378 if (count != items->size()) |
377 return false; | 379 return false; |
378 | 380 |
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 " \"state\": {" | 2085 " \"state\": {" |
2084 " \"previous\": \"in_progress\"," | 2086 " \"previous\": \"in_progress\"," |
2085 " \"current\": \"complete\"}}]", | 2087 " \"current\": \"complete\"}}]", |
2086 result_id, | 2088 result_id, |
2087 GetFilename("on_record.txt.crdownload").c_str(), | 2089 GetFilename("on_record.txt.crdownload").c_str(), |
2088 GetFilename("on_record.txt").c_str()))); | 2090 GetFilename("on_record.txt").c_str()))); |
2089 std::string disk_data; | 2091 std::string disk_data; |
2090 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); | 2092 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); |
2091 EXPECT_STREQ(kPayloadData, disk_data.c_str()); | 2093 EXPECT_STREQ(kPayloadData, disk_data.c_str()); |
2092 } | 2094 } |
OLD | NEW |