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

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

Issue 10825085: Move RunAllPendingInMessageLoop from ui_test_utils.h to test_utils.h, so that it can be reused by c… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 downloads_expected++; 674 downloads_expected++;
675 observer->WaitForFinished(); 675 observer->WaitForFinished();
676 DownloadItem::DownloadState final_state = 676 DownloadItem::DownloadState final_state =
677 (download_info.reason == content::DOWNLOAD_INTERRUPT_REASON_NONE) ? 677 (download_info.reason == content::DOWNLOAD_INTERRUPT_REASON_NONE) ?
678 DownloadItem::COMPLETE : 678 DownloadItem::COMPLETE :
679 DownloadItem::INTERRUPTED; 679 DownloadItem::INTERRUPTED;
680 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(final_state)); 680 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(final_state));
681 } 681 }
682 682
683 // Wait till the |DownloadFile|s are destroyed. 683 // Wait till the |DownloadFile|s are destroyed.
684 ui_test_utils::RunAllPendingInMessageLoop(content::BrowserThread::FILE); 684 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
685 ui_test_utils::RunAllPendingInMessageLoop(content::BrowserThread::UI); 685 content::RunAllPendingInMessageLoop(content::BrowserThread::UI);
686 686
687 // Validate that the correct files were downloaded. 687 // Validate that the correct files were downloaded.
688 download_items.clear(); 688 download_items.clear();
689 GetDownloads(browser(), &download_items); 689 GetDownloads(browser(), &download_items);
690 ASSERT_EQ(downloads_expected, download_items.size()) << s.str(); 690 ASSERT_EQ(downloads_expected, download_items.size()) << s.str();
691 691
692 if (download_info.show_download_item) { 692 if (download_info.show_download_item) {
693 // Find the last download item. 693 // Find the last download item.
694 DownloadItem* item = download_items[0]; 694 DownloadItem* item = download_items[0];
695 for (size_t d = 1; d < downloads_expected; ++d) { 695 for (size_t d = 1; d < downloads_expected; ++d) {
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 GetDownloads(browser(), &download_items); 2461 GetDownloads(browser(), &download_items);
2462 ASSERT_EQ(1u, download_items.size()); 2462 ASSERT_EQ(1u, download_items.size());
2463 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), 2463 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"),
2464 download_items[0]->GetOriginalUrl()); 2464 download_items[0]->GetOriginalUrl());
2465 2465
2466 // Check that the file contains the expected referrer. 2466 // Check that the file contains the expected referrer.
2467 FilePath file(download_items[0]->GetFullPath()); 2467 FilePath file(download_items[0]->GetFullPath());
2468 std::string expected_contents = test_server()->GetURL("").spec(); 2468 std::string expected_contents = test_server()->GetURL("").spec();
2469 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); 2469 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length()));
2470 } 2470 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698