| 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 -1, |
| 1574 "", |
| 1575 "", |
| 1576 "", |
| 1577 DOWNLOAD_INTERRUPT_REASON_NONE), |
| 1573 DownloadPersistentStoreInfo( | 1578 DownloadPersistentStoreInfo( |
| 1574 FilePath(FILE_PATH_LITERAL("/path/to/another_file")), | 1579 FilePath(FILE_PATH_LITERAL("/path/to/another_file")), |
| 1575 GURL("http://www.google.com/reality_download"), | 1580 GURL("http://www.google.com/reality_download"), |
| 1576 GURL(""), | 1581 GURL(""), |
| 1577 current - base::TimeDelta::FromMinutes(10), | 1582 current - base::TimeDelta::FromMinutes(10), |
| 1578 current, | 1583 current, |
| 1579 256, | 1584 256, |
| 1580 256, | 1585 256, |
| 1581 DownloadItem::COMPLETE, | 1586 DownloadItem::COMPLETE, |
| 1582 2, | 1587 2, |
| 1583 false), | 1588 false, |
| 1589 -1, |
| 1590 "", |
| 1591 "", |
| 1592 "", |
| 1593 DOWNLOAD_INTERRUPT_REASON_NONE), |
| 1584 DownloadPersistentStoreInfo( | 1594 DownloadPersistentStoreInfo( |
| 1585 FilePath(FILE_PATH_LITERAL("/different_path/to/another_file")), | 1595 FilePath(FILE_PATH_LITERAL("/different_path/to/another_file")), |
| 1586 GURL("http://www.izzle.com/not_really_a_download"), | 1596 GURL("http://www.izzle.com/not_really_a_download"), |
| 1587 GURL(""), | 1597 GURL(""), |
| 1588 current - base::TimeDelta::FromMinutes(15), | 1598 current - base::TimeDelta::FromMinutes(15), |
| 1589 current, | 1599 current, |
| 1590 512, | 1600 512, |
| 1591 512, | 1601 512, |
| 1592 DownloadItem::COMPLETE, | 1602 DownloadItem::COMPLETE, |
| 1593 3, | 1603 3, |
| 1594 true) | 1604 true, |
| 1605 -1, |
| 1606 "", |
| 1607 "", |
| 1608 "", |
| 1609 DOWNLOAD_INTERRUPT_REASON_NONE) |
| 1595 }; | 1610 }; |
| 1596 std::vector<DownloadPersistentStoreInfo> entries( | 1611 std::vector<DownloadPersistentStoreInfo> entries( |
| 1597 population_entries, population_entries + arraysize(population_entries)); | 1612 population_entries, population_entries + arraysize(population_entries)); |
| 1598 | 1613 |
| 1599 // Populate the manager. | 1614 // Populate the manager. |
| 1600 DownloadManager* manager = DownloadManagerForBrowser(browser()); | 1615 DownloadManager* manager = DownloadManagerForBrowser(browser()); |
| 1601 manager->OnPersistentStoreQueryComplete(&entries); | 1616 manager->OnPersistentStoreQueryComplete(&entries); |
| 1602 | 1617 |
| 1603 // Do some searches and check the results. | 1618 // Do some searches and check the results. |
| 1604 std::vector<DownloadItem*> search_results; | 1619 std::vector<DownloadItem*> search_results; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 search_results.clear(); | 1686 search_results.clear(); |
| 1672 | 1687 |
| 1673 manager->SearchDownloads(UTF8ToUTF16("another_file"), &search_results); | 1688 manager->SearchDownloads(UTF8ToUTF16("another_file"), &search_results); |
| 1674 ASSERT_EQ(2u, search_results.size()); | 1689 ASSERT_EQ(2u, search_results.size()); |
| 1675 std::sort(search_results.begin(), search_results.end(), | 1690 std::sort(search_results.begin(), search_results.end(), |
| 1676 DownloadItemSorter); | 1691 DownloadItemSorter); |
| 1677 EXPECT_EQ(2, search_results[0]->db_handle()); | 1692 EXPECT_EQ(2, search_results[0]->db_handle()); |
| 1678 EXPECT_EQ(3, search_results[1]->db_handle()); | 1693 EXPECT_EQ(3, search_results[1]->db_handle()); |
| 1679 search_results.clear(); | 1694 search_results.clear(); |
| 1680 } | 1695 } |
| OLD | NEW |