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

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

Issue 9568003: Fixed issue with DownloadTestObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added check that download finished in expected state. Created 8 years, 9 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/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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 712
713 DownloadManagerForBrowser(browser())->DownloadUrl( 713 DownloadManagerForBrowser(browser())->DownloadUrl(
714 url, GURL(""), "", false, -1, save_info, web_contents); 714 url, GURL(""), "", false, -1, save_info, web_contents);
715 } else { 715 } else {
716 // Navigate to URL normally, wait until done. 716 // Navigate to URL normally, wait until done.
717 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), 717 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(),
718 url, 718 url,
719 1); 719 1);
720 } 720 }
721 721
722 if (download_info.show_download_item) 722 if (download_info.show_download_item) {
723 observer->WaitForFinished(); 723 observer->WaitForFinished();
724 DCHECK_EQ(0u, observer->NumOtherDownloadsSeen());
725 }
724 726
725 // Validate that the correct file was downloaded. 727 // Validate that the correct file was downloaded.
726 download_items.clear(); 728 download_items.clear();
727 GetDownloads(browser(), &download_items); 729 GetDownloads(browser(), &download_items);
728 size_t item_count = download_info.show_download_item ? 1 : 0; 730 size_t item_count = download_info.show_download_item ? 1 : 0;
729 ASSERT_EQ(item_count, download_items.size()); 731 ASSERT_EQ(item_count, download_items.size());
730 732
731 if (download_info.show_download_item) { 733 if (download_info.show_download_item) {
732 DownloadItem* item = download_items[0]; 734 DownloadItem* item = download_items[0];
733 ASSERT_EQ(url, item->GetOriginalUrl()); 735 ASSERT_EQ(url, item->GetOriginalUrl());
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 "zip_file_not_found.zip", 2076 "zip_file_not_found.zip",
2075 DOWNLOAD_NAVIGATE, 2077 DOWNLOAD_NAVIGATE,
2076 DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED, 2078 DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED,
2077 false 2079 false
2078 }; 2080 };
2079 2081
2080 // Do initial setup. 2082 // Do initial setup.
2081 ASSERT_TRUE(InitialSetup(false)); 2083 ASSERT_TRUE(InitialSetup(false));
2082 DownloadFileCheckErrors(download_info); 2084 DownloadFileCheckErrors(download_info);
2083 } 2085 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_test_observer.h » ('j') | chrome/browser/download/download_test_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698