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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 #endif // defined(TOUCH_UI) | 599 #endif // defined(TOUCH_UI) |
600 | 600 |
601 ASSERT_TRUE(downloads_ui); | 601 ASSERT_TRUE(downloads_ui); |
602 const ActiveDownloadsUI::DownloadList& downloads = | 602 const ActiveDownloadsUI::DownloadList& downloads = |
603 downloads_ui->GetDownloads(); | 603 downloads_ui->GetDownloads(); |
604 EXPECT_EQ(downloads.size(), 1U); | 604 EXPECT_EQ(downloads.size(), 1U); |
605 | 605 |
606 FilePath full_path(DestinationFile(browser, filename)); | 606 FilePath full_path(DestinationFile(browser, filename)); |
607 bool exists = false; | 607 bool exists = false; |
608 for (size_t i = 0; i < downloads.size(); ++i) { | 608 for (size_t i = 0; i < downloads.size(); ++i) { |
609 if (downloads[i]->full_path() == full_path) { | 609 if (downloads[i]->GetFullPath() == full_path) { |
610 exists = true; | 610 exists = true; |
611 break; | 611 break; |
612 } | 612 } |
613 } | 613 } |
614 EXPECT_TRUE(exists); | 614 EXPECT_TRUE(exists); |
615 #else | 615 #else |
616 EXPECT_EQ(expected_non_cros, browser->window()->IsDownloadShelfVisible()); | 616 EXPECT_EQ(expected_non_cros, browser->window()->IsDownloadShelfVisible()); |
617 // TODO: Check for filename match in download shelf. | 617 // TODO: Check for filename match in download shelf. |
618 #endif | 618 #endif |
619 } | 619 } |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 scoped_ptr<DownloadTestObserver> observer1( | 1156 scoped_ptr<DownloadTestObserver> observer1( |
1157 CreateInProgressWaiter(browser(), 1)); | 1157 CreateInProgressWaiter(browser(), 1)); |
1158 ui_test_utils::NavigateToURL( | 1158 ui_test_utils::NavigateToURL( |
1159 browser(), GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl)); | 1159 browser(), GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl)); |
1160 observer1->WaitForFinished(); | 1160 observer1->WaitForFinished(); |
1161 | 1161 |
1162 std::vector<DownloadItem*> downloads; | 1162 std::vector<DownloadItem*> downloads; |
1163 browser()->profile()->GetDownloadManager()->SearchDownloads( | 1163 browser()->profile()->GetDownloadManager()->SearchDownloads( |
1164 string16(), &downloads); | 1164 string16(), &downloads); |
1165 ASSERT_EQ(1u, downloads.size()); | 1165 ASSERT_EQ(1u, downloads.size()); |
1166 ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->state()); | 1166 ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->GetState()); |
1167 CheckDownloadUI(browser(), true, true, FilePath()); | 1167 CheckDownloadUI(browser(), true, true, FilePath()); |
1168 DownloadItem* download1 = downloads[0]; // The only download. | 1168 DownloadItem* download1 = downloads[0]; // The only download. |
1169 | 1169 |
1170 // Start the second download and wait until it's done. | 1170 // Start the second download and wait until it's done. |
1171 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1171 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
1172 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1172 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
1173 // Download the file and wait. We do not expect the Select File dialog. | 1173 // Download the file and wait. We do not expect the Select File dialog. |
1174 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); | 1174 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
1175 | 1175 |
1176 // Should now have 2 items on the download shelf. | 1176 // Should now have 2 items on the download shelf. |
1177 downloads.clear(); | 1177 downloads.clear(); |
1178 browser()->profile()->GetDownloadManager()->SearchDownloads( | 1178 browser()->profile()->GetDownloadManager()->SearchDownloads( |
1179 string16(), &downloads); | 1179 string16(), &downloads); |
1180 ASSERT_EQ(2u, downloads.size()); | 1180 ASSERT_EQ(2u, downloads.size()); |
1181 // We don't know the order of the downloads. | 1181 // We don't know the order of the downloads. |
1182 DownloadItem* download2 = downloads[(download1 == downloads[0]) ? 1 : 0]; | 1182 DownloadItem* download2 = downloads[(download1 == downloads[0]) ? 1 : 0]; |
1183 | 1183 |
1184 ASSERT_EQ(DownloadItem::IN_PROGRESS, download1->state()); | 1184 ASSERT_EQ(DownloadItem::IN_PROGRESS, download1->GetState()); |
1185 ASSERT_EQ(DownloadItem::COMPLETE, download2->state()); | 1185 ASSERT_EQ(DownloadItem::COMPLETE, download2->GetState()); |
1186 // The download shelf should be open. | 1186 // The download shelf should be open. |
1187 CheckDownloadUI(browser(), true, true, FilePath()); | 1187 CheckDownloadUI(browser(), true, true, FilePath()); |
1188 | 1188 |
1189 // Allow the first request to finish. We do this by loading a third URL | 1189 // Allow the first request to finish. We do this by loading a third URL |
1190 // in a separate tab. | 1190 // in a separate tab. |
1191 scoped_ptr<DownloadTestObserver> observer2(CreateWaiter(browser(), 1)); | 1191 scoped_ptr<DownloadTestObserver> observer2(CreateWaiter(browser(), 1)); |
1192 GURL finish_url(URLRequestSlowDownloadJob::kFinishDownloadUrl); | 1192 GURL finish_url(URLRequestSlowDownloadJob::kFinishDownloadUrl); |
1193 ui_test_utils::NavigateToURLWithDisposition( | 1193 ui_test_utils::NavigateToURLWithDisposition( |
1194 browser(), | 1194 browser(), |
1195 finish_url, | 1195 finish_url, |
1196 NEW_FOREGROUND_TAB, | 1196 NEW_FOREGROUND_TAB, |
1197 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1197 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
1198 observer2->WaitForFinished(); // Wait for the third request. | 1198 observer2->WaitForFinished(); // Wait for the third request. |
1199 | 1199 |
1200 // Get the important info from other threads and check it. | 1200 // Get the important info from other threads and check it. |
1201 scoped_refptr<CancelTestDataCollector> info(new CancelTestDataCollector()); | 1201 scoped_refptr<CancelTestDataCollector> info(new CancelTestDataCollector()); |
1202 info->WaitForDataCollected(); | 1202 info->WaitForDataCollected(); |
1203 EXPECT_EQ(0, info->dfm_pending_downloads()); | 1203 EXPECT_EQ(0, info->dfm_pending_downloads()); |
1204 | 1204 |
1205 CheckDownloadUI(browser(), true, true, FilePath()); | 1205 CheckDownloadUI(browser(), true, true, FilePath()); |
1206 | 1206 |
1207 // The |DownloadItem|s should now be done and have the final file names. | 1207 // The |DownloadItem|s should now be done and have the final file names. |
1208 // Verify that the files have the expected data and size. | 1208 // Verify that the files have the expected data and size. |
1209 // |file1| should be full of '*'s, and |file2| should be the same as the | 1209 // |file1| should be full of '*'s, and |file2| should be the same as the |
1210 // source file. | 1210 // source file. |
1211 FilePath file1(download1->full_path()); | 1211 FilePath file1(download1->GetFullPath()); |
1212 size_t file_size1 = URLRequestSlowDownloadJob::kFirstDownloadSize + | 1212 size_t file_size1 = URLRequestSlowDownloadJob::kFirstDownloadSize + |
1213 URLRequestSlowDownloadJob::kSecondDownloadSize; | 1213 URLRequestSlowDownloadJob::kSecondDownloadSize; |
1214 std::string expected_contents(file_size1, '*'); | 1214 std::string expected_contents(file_size1, '*'); |
1215 ASSERT_TRUE(VerifyFile(file1, expected_contents, file_size1)); | 1215 ASSERT_TRUE(VerifyFile(file1, expected_contents, file_size1)); |
1216 | 1216 |
1217 FilePath file2(download2->full_path()); | 1217 FilePath file2(download2->GetFullPath()); |
1218 ASSERT_TRUE(file_util::ContentsEqual(OriginFile(file), file2)); | 1218 ASSERT_TRUE(file_util::ContentsEqual(OriginFile(file), file2)); |
1219 } | 1219 } |
1220 | 1220 |
1221 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadCancelled) { | 1221 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadCancelled) { |
1222 ASSERT_TRUE(InitialSetup(false)); | 1222 ASSERT_TRUE(InitialSetup(false)); |
1223 EXPECT_EQ(1, browser()->tab_count()); | 1223 EXPECT_EQ(1, browser()->tab_count()); |
1224 | 1224 |
1225 // TODO(rdsmith): Fragile code warning! The code below relies on the | 1225 // TODO(rdsmith): Fragile code warning! The code below relies on the |
1226 // DownloadTestObserver only finishing when the new download has reached | 1226 // DownloadTestObserver only finishing when the new download has reached |
1227 // the state of being entered into the history and being user-visible | 1227 // the state of being entered into the history and being user-visible |
(...skipping 15 matching lines...) Expand all Loading... |
1243 scoped_ptr<DownloadTestObserver> observer( | 1243 scoped_ptr<DownloadTestObserver> observer( |
1244 CreateInProgressWaiter(browser(), 1)); | 1244 CreateInProgressWaiter(browser(), 1)); |
1245 ui_test_utils::NavigateToURL( | 1245 ui_test_utils::NavigateToURL( |
1246 browser(), GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl)); | 1246 browser(), GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl)); |
1247 observer->WaitForFinished(); | 1247 observer->WaitForFinished(); |
1248 | 1248 |
1249 std::vector<DownloadItem*> downloads; | 1249 std::vector<DownloadItem*> downloads; |
1250 DownloadManagerForBrowser(browser())->SearchDownloads( | 1250 DownloadManagerForBrowser(browser())->SearchDownloads( |
1251 string16(), &downloads); | 1251 string16(), &downloads); |
1252 ASSERT_EQ(1u, downloads.size()); | 1252 ASSERT_EQ(1u, downloads.size()); |
1253 ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->state()); | 1253 ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->GetState()); |
1254 CheckDownloadUI(browser(), true, true, FilePath()); | 1254 CheckDownloadUI(browser(), true, true, FilePath()); |
1255 | 1255 |
1256 // Cancel the download and wait for download system quiesce. | 1256 // Cancel the download and wait for download system quiesce. |
1257 downloads[0]->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 1257 downloads[0]->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
1258 scoped_refptr<DownloadTestFlushObserver> flush_observer( | 1258 scoped_refptr<DownloadTestFlushObserver> flush_observer( |
1259 new DownloadTestFlushObserver( | 1259 new DownloadTestFlushObserver( |
1260 DownloadManagerForBrowser(browser()))); | 1260 DownloadManagerForBrowser(browser()))); |
1261 flush_observer->WaitForFlush(); | 1261 flush_observer->WaitForFlush(); |
1262 | 1262 |
1263 // Get the important info from other threads and check it. | 1263 // Get the important info from other threads and check it. |
(...skipping 17 matching lines...) Expand all Loading... |
1281 int64 origin_size; | 1281 int64 origin_size; |
1282 file_util::GetFileSize(origin_file, &origin_size); | 1282 file_util::GetFileSize(origin_file, &origin_size); |
1283 | 1283 |
1284 // Download the file and wait. We do not expect the Select File dialog. | 1284 // Download the file and wait. We do not expect the Select File dialog. |
1285 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); | 1285 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
1286 | 1286 |
1287 // Get details of what downloads have just happened. | 1287 // Get details of what downloads have just happened. |
1288 std::vector<DownloadItem*> downloads; | 1288 std::vector<DownloadItem*> downloads; |
1289 GetDownloads(browser(), &downloads); | 1289 GetDownloads(browser(), &downloads); |
1290 ASSERT_EQ(1u, downloads.size()); | 1290 ASSERT_EQ(1u, downloads.size()); |
1291 int64 db_handle = downloads[0]->db_handle(); | 1291 int64 db_handle = downloads[0]->GetDbHandle(); |
1292 | 1292 |
1293 // Check state. | 1293 // Check state. |
1294 EXPECT_EQ(1, browser()->tab_count()); | 1294 EXPECT_EQ(1, browser()->tab_count()); |
1295 CheckDownload(browser(), file, file); | 1295 CheckDownload(browser(), file, file); |
1296 CheckDownloadUI(browser(), true, true, file); | 1296 CheckDownloadUI(browser(), true, true, file); |
1297 | 1297 |
1298 // Check history results. | 1298 // Check history results. |
1299 DownloadsHistoryDataCollector history_collector( | 1299 DownloadsHistoryDataCollector history_collector( |
1300 db_handle, | 1300 db_handle, |
1301 DownloadManagerForBrowser(browser())); | 1301 DownloadManagerForBrowser(browser())); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 MockDownloadOpeningObserver observer( | 1394 MockDownloadOpeningObserver observer( |
1395 DownloadManagerForBrowser(browser())); | 1395 DownloadManagerForBrowser(browser())); |
1396 | 1396 |
1397 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); | 1397 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
1398 | 1398 |
1399 // Find the download and confirm it was opened. | 1399 // Find the download and confirm it was opened. |
1400 std::vector<DownloadItem*> downloads; | 1400 std::vector<DownloadItem*> downloads; |
1401 DownloadManagerForBrowser(browser())->SearchDownloads( | 1401 DownloadManagerForBrowser(browser())->SearchDownloads( |
1402 string16(), &downloads); | 1402 string16(), &downloads); |
1403 ASSERT_EQ(1u, downloads.size()); | 1403 ASSERT_EQ(1u, downloads.size()); |
1404 EXPECT_EQ(DownloadItem::COMPLETE, downloads[0]->state()); | 1404 EXPECT_EQ(DownloadItem::COMPLETE, downloads[0]->GetState()); |
1405 EXPECT_TRUE(downloads[0]->opened()); | 1405 EXPECT_TRUE(downloads[0]->GetOpened()); |
1406 | 1406 |
1407 // As long as we're here, confirmed everything else is good. | 1407 // As long as we're here, confirmed everything else is good. |
1408 EXPECT_EQ(1, browser()->tab_count()); | 1408 EXPECT_EQ(1, browser()->tab_count()); |
1409 CheckDownload(browser(), file, file); | 1409 CheckDownload(browser(), file, file); |
1410 // Download shelf should close. Download panel stays open on ChromeOS. | 1410 // Download shelf should close. Download panel stays open on ChromeOS. |
1411 CheckDownloadUI(browser(), false, true, FilePath()); | 1411 CheckDownloadUI(browser(), false, true, FilePath()); |
1412 } | 1412 } |
1413 | 1413 |
1414 // Download an extension. Expect a dangerous download warning. | 1414 // Download an extension. Expect a dangerous download warning. |
1415 // Deny the download. | 1415 // Deny the download. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 CheckDownloadUI(browser(), false, true, FilePath()); | 1542 CheckDownloadUI(browser(), false, true, FilePath()); |
1543 | 1543 |
1544 // Check that the extension was installed. | 1544 // Check that the extension was installed. |
1545 ExtensionService* extension_service = | 1545 ExtensionService* extension_service = |
1546 browser()->profile()->GetExtensionService(); | 1546 browser()->profile()->GetExtensionService(); |
1547 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); | 1547 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); |
1548 } | 1548 } |
1549 | 1549 |
1550 // Sort download items by db_handle. | 1550 // Sort download items by db_handle. |
1551 static bool DownloadItemSorter(DownloadItem* d1, DownloadItem* d2) { | 1551 static bool DownloadItemSorter(DownloadItem* d1, DownloadItem* d2) { |
1552 return d1->db_handle() < d2->db_handle(); | 1552 return d1->GetDbHandle() < d2->GetDbHandle(); |
1553 } | 1553 } |
1554 | 1554 |
1555 // Confirm that searching through the history works properly | 1555 // Confirm that searching through the history works properly |
1556 IN_PROC_BROWSER_TEST_F(DownloadTest, SearchDownloads) { | 1556 IN_PROC_BROWSER_TEST_F(DownloadTest, SearchDownloads) { |
1557 ASSERT_TRUE(InitialSetup(false)); | 1557 ASSERT_TRUE(InitialSetup(false)); |
1558 | 1558 |
1559 // Downloads to populate history with. | 1559 // Downloads to populate history with. |
1560 base::Time current(base::Time::Now()); | 1560 base::Time current(base::Time::Now()); |
1561 DownloadPersistentStoreInfo population_entries[] = { | 1561 DownloadPersistentStoreInfo population_entries[] = { |
1562 DownloadPersistentStoreInfo( | 1562 DownloadPersistentStoreInfo( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 manager->SearchDownloads(string16(), &search_results); | 1606 manager->SearchDownloads(string16(), &search_results); |
1607 ASSERT_EQ(3u, search_results.size()); | 1607 ASSERT_EQ(3u, search_results.size()); |
1608 std::sort(search_results.begin(), search_results.end(), | 1608 std::sort(search_results.begin(), search_results.end(), |
1609 DownloadItemSorter); | 1609 DownloadItemSorter); |
1610 // We do a full check only once to protect against the data | 1610 // We do a full check only once to protect against the data |
1611 // somehow getting scrambled on its way into the DownloadItems. | 1611 // somehow getting scrambled on its way into the DownloadItems. |
1612 { | 1612 { |
1613 DownloadItem* d1 = search_results[0]; | 1613 DownloadItem* d1 = search_results[0]; |
1614 DownloadItem* d2 = search_results[1]; | 1614 DownloadItem* d2 = search_results[1]; |
1615 DownloadItem* d3 = search_results[2]; | 1615 DownloadItem* d3 = search_results[2]; |
1616 EXPECT_EQ(FilePath(FILE_PATH_LITERAL("/path/to/file")), d1->full_path()); | 1616 EXPECT_EQ(FilePath(FILE_PATH_LITERAL("/path/to/file")), d1->GetFullPath()); |
1617 EXPECT_EQ(GURL("http://www.google.com/fantasy_download"), | 1617 EXPECT_EQ(GURL("http://www.google.com/fantasy_download"), |
1618 d1->original_url()); | 1618 d1->GetOriginalUrl()); |
1619 EXPECT_EQ(current - base::TimeDelta::FromMinutes(5), | 1619 EXPECT_EQ(current - base::TimeDelta::FromMinutes(5), |
1620 d1->start_time()); | 1620 d1->GetStartTime()); |
1621 EXPECT_EQ(current, d1->end_time()); | 1621 EXPECT_EQ(current, d1->GetEndTime()); |
1622 EXPECT_EQ(128, d1->received_bytes()); | 1622 EXPECT_EQ(128, d1->GetReceivedBytes()); |
1623 EXPECT_EQ(128, d1->total_bytes()); | 1623 EXPECT_EQ(128, d1->GetTotalBytes()); |
1624 EXPECT_EQ(DownloadItem::COMPLETE, d1->state()); | 1624 EXPECT_EQ(DownloadItem::COMPLETE, d1->GetState()); |
1625 EXPECT_EQ(1, d1->db_handle()); | 1625 EXPECT_EQ(1, d1->GetDbHandle()); |
1626 EXPECT_FALSE(d1->opened()); | 1626 EXPECT_FALSE(d1->GetOpened()); |
1627 | 1627 |
1628 EXPECT_EQ(FilePath(FILE_PATH_LITERAL("/path/to/another_file")), | 1628 EXPECT_EQ(FilePath(FILE_PATH_LITERAL("/path/to/another_file")), |
1629 d2->full_path()); | 1629 d2->GetFullPath()); |
1630 EXPECT_EQ(GURL("http://www.google.com/reality_download"), | 1630 EXPECT_EQ(GURL("http://www.google.com/reality_download"), |
1631 d2->original_url()); | 1631 d2->GetOriginalUrl()); |
1632 EXPECT_EQ(current - base::TimeDelta::FromMinutes(10), | 1632 EXPECT_EQ(current - base::TimeDelta::FromMinutes(10), |
1633 d2->start_time()); | 1633 d2->GetStartTime()); |
1634 EXPECT_EQ(current, d2->end_time()); | 1634 EXPECT_EQ(current, d2->GetEndTime()); |
1635 EXPECT_EQ(256, d2->received_bytes()); | 1635 EXPECT_EQ(256, d2->GetReceivedBytes()); |
1636 EXPECT_EQ(256, d2->total_bytes()); | 1636 EXPECT_EQ(256, d2->GetTotalBytes()); |
1637 EXPECT_EQ(DownloadItem::COMPLETE, d2->state()); | 1637 EXPECT_EQ(DownloadItem::COMPLETE, d2->GetState()); |
1638 EXPECT_EQ(2, d2->db_handle()); | 1638 EXPECT_EQ(2, d2->GetDbHandle()); |
1639 EXPECT_FALSE(d2->opened()); | 1639 EXPECT_FALSE(d2->GetOpened()); |
1640 | 1640 |
1641 EXPECT_EQ(FilePath(FILE_PATH_LITERAL("/different_path/to/another_file")), | 1641 EXPECT_EQ(FilePath(FILE_PATH_LITERAL("/different_path/to/another_file")), |
1642 d3->full_path()); | 1642 d3->GetFullPath()); |
1643 EXPECT_EQ(GURL("http://www.izzle.com/not_really_a_download"), | 1643 EXPECT_EQ(GURL("http://www.izzle.com/not_really_a_download"), |
1644 d3->original_url()); | 1644 d3->GetOriginalUrl()); |
1645 EXPECT_EQ(current - base::TimeDelta::FromMinutes(15), | 1645 EXPECT_EQ(current - base::TimeDelta::FromMinutes(15), |
1646 d3->start_time()); | 1646 d3->GetStartTime()); |
1647 EXPECT_EQ(current, d3->end_time()); | 1647 EXPECT_EQ(current, d3->GetEndTime()); |
1648 EXPECT_EQ(512, d3->received_bytes()); | 1648 EXPECT_EQ(512, d3->GetReceivedBytes()); |
1649 EXPECT_EQ(512, d3->total_bytes()); | 1649 EXPECT_EQ(512, d3->GetTotalBytes()); |
1650 EXPECT_EQ(DownloadItem::COMPLETE, d3->state()); | 1650 EXPECT_EQ(DownloadItem::COMPLETE, d3->GetState()); |
1651 EXPECT_EQ(3, d3->db_handle()); | 1651 EXPECT_EQ(3, d3->GetDbHandle()); |
1652 EXPECT_TRUE(d3->opened()); | 1652 EXPECT_TRUE(d3->GetOpened()); |
1653 } | 1653 } |
1654 search_results.clear(); | 1654 search_results.clear(); |
1655 | 1655 |
1656 string16 search_input; | 1656 string16 search_input; |
1657 manager->SearchDownloads(UTF8ToUTF16("www.google.com"), &search_results); | 1657 manager->SearchDownloads(UTF8ToUTF16("www.google.com"), &search_results); |
1658 ASSERT_EQ(2u, search_results.size()); | 1658 ASSERT_EQ(2u, search_results.size()); |
1659 std::sort(search_results.begin(), search_results.end(), | 1659 std::sort(search_results.begin(), search_results.end(), |
1660 DownloadItemSorter); | 1660 DownloadItemSorter); |
1661 EXPECT_EQ(1, search_results[0]->db_handle()); | 1661 EXPECT_EQ(1, search_results[0]->GetDbHandle()); |
1662 EXPECT_EQ(2, search_results[1]->db_handle()); | 1662 EXPECT_EQ(2, search_results[1]->GetDbHandle()); |
1663 search_results.clear(); | 1663 search_results.clear(); |
1664 | 1664 |
1665 manager->SearchDownloads(UTF8ToUTF16("real"), &search_results); | 1665 manager->SearchDownloads(UTF8ToUTF16("real"), &search_results); |
1666 ASSERT_EQ(2u, search_results.size()); | 1666 ASSERT_EQ(2u, search_results.size()); |
1667 std::sort(search_results.begin(), search_results.end(), | 1667 std::sort(search_results.begin(), search_results.end(), |
1668 DownloadItemSorter); | 1668 DownloadItemSorter); |
1669 EXPECT_EQ(2, search_results[0]->db_handle()); | 1669 EXPECT_EQ(2, search_results[0]->GetDbHandle()); |
1670 EXPECT_EQ(3, search_results[1]->db_handle()); | 1670 EXPECT_EQ(3, search_results[1]->GetDbHandle()); |
1671 search_results.clear(); | 1671 search_results.clear(); |
1672 | 1672 |
1673 manager->SearchDownloads(UTF8ToUTF16("another_file"), &search_results); | 1673 manager->SearchDownloads(UTF8ToUTF16("another_file"), &search_results); |
1674 ASSERT_EQ(2u, search_results.size()); | 1674 ASSERT_EQ(2u, search_results.size()); |
1675 std::sort(search_results.begin(), search_results.end(), | 1675 std::sort(search_results.begin(), search_results.end(), |
1676 DownloadItemSorter); | 1676 DownloadItemSorter); |
1677 EXPECT_EQ(2, search_results[0]->db_handle()); | 1677 EXPECT_EQ(2, search_results[0]->GetDbHandle()); |
1678 EXPECT_EQ(3, search_results[1]->db_handle()); | 1678 EXPECT_EQ(3, search_results[1]->GetDbHandle()); |
1679 search_results.clear(); | 1679 search_results.clear(); |
1680 } | 1680 } |
OLD | NEW |