| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 DownloadPersistentStoreInfo( | 1562 DownloadPersistentStoreInfo( |
| 1563 FilePath(FILE_PATH_LITERAL("/path/to/file")), | 1563 FilePath(FILE_PATH_LITERAL("/path/to/file")), |
| 1564 GURL("http://www.google.com/fantasy_download"), | 1564 GURL("http://www.google.com/fantasy_download"), |
| 1565 GURL(""), | 1565 GURL(""), |
| 1566 current - base::TimeDelta::FromMinutes(5), | 1566 current - base::TimeDelta::FromMinutes(5), |
| 1567 current, | 1567 current, |
| 1568 128, | 1568 128, |
| 1569 128, | 1569 128, |
| 1570 DownloadItem::COMPLETE, | 1570 DownloadItem::COMPLETE, |
| 1571 1, | 1571 1, |
| 1572 false), | 1572 false, |
| 1573 "", |
| 1574 "", |
| 1575 "", |
| 1576 DOWNLOAD_INTERRUPT_REASON_NONE), |
| 1573 DownloadPersistentStoreInfo( | 1577 DownloadPersistentStoreInfo( |
| 1574 FilePath(FILE_PATH_LITERAL("/path/to/another_file")), | 1578 FilePath(FILE_PATH_LITERAL("/path/to/another_file")), |
| 1575 GURL("http://www.google.com/reality_download"), | 1579 GURL("http://www.google.com/reality_download"), |
| 1576 GURL(""), | 1580 GURL(""), |
| 1577 current - base::TimeDelta::FromMinutes(10), | 1581 current - base::TimeDelta::FromMinutes(10), |
| 1578 current, | 1582 current, |
| 1579 256, | 1583 256, |
| 1580 256, | 1584 256, |
| 1581 DownloadItem::COMPLETE, | 1585 DownloadItem::COMPLETE, |
| 1582 2, | 1586 2, |
| 1583 false), | 1587 false, |
| 1588 "", |
| 1589 "", |
| 1590 "", |
| 1591 DOWNLOAD_INTERRUPT_REASON_NONE), |
| 1584 DownloadPersistentStoreInfo( | 1592 DownloadPersistentStoreInfo( |
| 1585 FilePath(FILE_PATH_LITERAL("/different_path/to/another_file")), | 1593 FilePath(FILE_PATH_LITERAL("/different_path/to/another_file")), |
| 1586 GURL("http://www.izzle.com/not_really_a_download"), | 1594 GURL("http://www.izzle.com/not_really_a_download"), |
| 1587 GURL(""), | 1595 GURL(""), |
| 1588 current - base::TimeDelta::FromMinutes(15), | 1596 current - base::TimeDelta::FromMinutes(15), |
| 1589 current, | 1597 current, |
| 1590 512, | 1598 512, |
| 1591 512, | 1599 512, |
| 1592 DownloadItem::COMPLETE, | 1600 DownloadItem::COMPLETE, |
| 1593 3, | 1601 3, |
| 1594 true) | 1602 true, |
| 1603 "", |
| 1604 "", |
| 1605 "", |
| 1606 DOWNLOAD_INTERRUPT_REASON_NONE) |
| 1595 }; | 1607 }; |
| 1596 std::vector<DownloadPersistentStoreInfo> entries( | 1608 std::vector<DownloadPersistentStoreInfo> entries( |
| 1597 population_entries, population_entries + arraysize(population_entries)); | 1609 population_entries, population_entries + arraysize(population_entries)); |
| 1598 | 1610 |
| 1599 // Populate the manager. | 1611 // Populate the manager. |
| 1600 DownloadManager* manager = DownloadManagerForBrowser(browser()); | 1612 DownloadManager* manager = DownloadManagerForBrowser(browser()); |
| 1601 manager->OnPersistentStoreQueryComplete(&entries); | 1613 manager->OnPersistentStoreQueryComplete(&entries); |
| 1602 | 1614 |
| 1603 // Do some searches and check the results. | 1615 // Do some searches and check the results. |
| 1604 std::vector<DownloadItem*> search_results; | 1616 std::vector<DownloadItem*> search_results; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 search_results.clear(); | 1683 search_results.clear(); |
| 1672 | 1684 |
| 1673 manager->SearchDownloads(UTF8ToUTF16("another_file"), &search_results); | 1685 manager->SearchDownloads(UTF8ToUTF16("another_file"), &search_results); |
| 1674 ASSERT_EQ(2u, search_results.size()); | 1686 ASSERT_EQ(2u, search_results.size()); |
| 1675 std::sort(search_results.begin(), search_results.end(), | 1687 std::sort(search_results.begin(), search_results.end(), |
| 1676 DownloadItemSorter); | 1688 DownloadItemSorter); |
| 1677 EXPECT_EQ(2, search_results[0]->db_handle()); | 1689 EXPECT_EQ(2, search_results[0]->db_handle()); |
| 1678 EXPECT_EQ(3, search_results[1]->db_handle()); | 1690 EXPECT_EQ(3, search_results[1]->db_handle()); |
| 1679 search_results.clear(); | 1691 search_results.clear(); |
| 1680 } | 1692 } |
| OLD | NEW |