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