Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/download/save_page_browsertest.cc

Issue 10905215: Kill DownloadManager::SearchDownloads, DownloadItem::MatchesQuery (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 EXPECT_FALSE(file_util::PathExists(dir)); 288 EXPECT_FALSE(file_util::PathExists(dir));
289 EXPECT_TRUE(file_util::ContentsEqual( 289 EXPECT_TRUE(file_util::ContentsEqual(
290 test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), 290 test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")),
291 full_file_name)); 291 full_file_name));
292 } 292 }
293 293
294 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyCancel) { 294 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyCancel) {
295 GURL url = NavigateToMockURL("a"); 295 GURL url = NavigateToMockURL("a");
296 DownloadManager* manager(GetDownloadManager()); 296 DownloadManager* manager(GetDownloadManager());
297 std::vector<DownloadItem*> downloads; 297 std::vector<DownloadItem*> downloads;
298 manager->SearchDownloads(string16(), &downloads); 298 manager->GetAllDownloads(&downloads);
299 ASSERT_EQ(0u, downloads.size()); 299 ASSERT_EQ(0u, downloads.size());
300 300
301 FilePath full_file_name, dir; 301 FilePath full_file_name, dir;
302 GetDestinationPaths("a", &full_file_name, &dir); 302 GetDestinationPaths("a", &full_file_name, &dir);
303 DownloadItemCreatedObserver creation_observer(manager); 303 DownloadItemCreatedObserver creation_observer(manager);
304 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir, 304 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir,
305 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); 305 content::SAVE_PAGE_TYPE_AS_ONLY_HTML));
306 DownloadItem* item = creation_observer.WaitForNewDownloadItem(); 306 DownloadItem* item = creation_observer.WaitForNewDownloadItem();
307 item->Cancel(true); 307 item->Cancel(true);
308 308
(...skipping 10 matching lines...) Expand all
319 test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), 319 test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")),
320 full_file_name)); 320 full_file_name));
321 } 321 }
322 322
323 // SavePageBrowserTest.SaveHTMLOnlyTabDestroy is flaky. 323 // SavePageBrowserTest.SaveHTMLOnlyTabDestroy is flaky.
324 // See http://crbug.com/144751. 324 // See http://crbug.com/144751.
325 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, DISABLED_SaveHTMLOnlyTabDestroy) { 325 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, DISABLED_SaveHTMLOnlyTabDestroy) {
326 GURL url = NavigateToMockURL("a"); 326 GURL url = NavigateToMockURL("a");
327 DownloadManager* manager(GetDownloadManager()); 327 DownloadManager* manager(GetDownloadManager());
328 std::vector<DownloadItem*> downloads; 328 std::vector<DownloadItem*> downloads;
329 manager->SearchDownloads(string16(), &downloads); 329 manager->GetAllDownloads(&downloads);
330 ASSERT_EQ(0u, downloads.size()); 330 ASSERT_EQ(0u, downloads.size());
331 331
332 FilePath full_file_name, dir; 332 FilePath full_file_name, dir;
333 GetDestinationPaths("a", &full_file_name, &dir); 333 GetDestinationPaths("a", &full_file_name, &dir);
334 DownloadItemCreatedObserver creation_observer(manager); 334 DownloadItemCreatedObserver creation_observer(manager);
335 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir, 335 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir,
336 content::SAVE_PAGE_TYPE_AS_ONLY_HTML)); 336 content::SAVE_PAGE_TYPE_AS_ONLY_HTML));
337 DownloadItem* item = creation_observer.WaitForNewDownloadItem(); 337 DownloadItem* item = creation_observer.WaitForNewDownloadItem();
338 338
339 // Close the tab; does this cancel the download? 339 // Close the tab; does this cancel the download?
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 content::NotificationService::AllSources()); 520 content::NotificationService::AllSources());
521 chrome::SavePage(browser()); 521 chrome::SavePage(browser());
522 observer.Wait(); 522 observer.Wait();
523 CheckDownloadHistory(url, full_file_name, -1); 523 CheckDownloadHistory(url, full_file_name, -1);
524 524
525 EXPECT_TRUE(file_util::PathExists(full_file_name)); 525 EXPECT_TRUE(file_util::PathExists(full_file_name));
526 int64 actual_file_size = -1; 526 int64 actual_file_size = -1;
527 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); 527 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size));
528 EXPECT_LE(kFileSizeMin, actual_file_size); 528 EXPECT_LE(kFileSizeMin, actual_file_size);
529 } 529 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698