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

Side by Side Diff: chrome/browser/ui/browser_close_browsertest.cc

Issue 9568003: Fixed issue with DownloadTestObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split DownloadTestObserver further. 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/download/download_service.h" 10 #include "chrome/browser/download/download_service.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); 108 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl);
109 109
110 if (num_downloads == 0) 110 if (num_downloads == 0)
111 return; 111 return;
112 112
113 // Setup an observer waiting for the given number of downloads 113 // Setup an observer waiting for the given number of downloads
114 // to get to IN_PROGRESS. 114 // to get to IN_PROGRESS.
115 DownloadManager* download_manager = 115 DownloadManager* download_manager =
116 browser->profile()->GetDownloadManager(); 116 browser->profile()->GetDownloadManager();
117 scoped_ptr<DownloadTestObserver> observer( 117 scoped_ptr<DownloadTestObserver> observer(
118 new DownloadTestObserver( 118 new DownloadTestObserverInProgress(download_manager, num_downloads));
119 download_manager, num_downloads,
120 DownloadItem::IN_PROGRESS,
121 true, // Bail on select file.
122 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
123 119
124 // Set of that number of downloads. 120 // Set of that number of downloads.
125 while (num_downloads--) 121 while (num_downloads--)
126 ui_test_utils::NavigateToURLWithDisposition( 122 ui_test_utils::NavigateToURLWithDisposition(
127 browser, url, NEW_BACKGROUND_TAB, 123 browser, url, NEW_BACKGROUND_TAB,
128 ui_test_utils::BROWSER_TEST_NONE); 124 ui_test_utils::BROWSER_TEST_NONE);
129 125
130 // Wait for them. 126 // Wait for them.
131 observer->WaitForFinished(); 127 observer->WaitForFinished();
128 DCHECK_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::IN_PROGRESS));
Randy Smith (Not in Mondays) 2012/03/08 18:25:31 Why is this 1 rather than the value num_downloads
ahendrickson 2012/03/08 20:56:34 Cut & paste error. Fixed.
132 } 129 }
133 130
134 // All all downloads created in CreateStalledDownloads() to 131 // All all downloads created in CreateStalledDownloads() to
135 // complete, and block in this routine until they do complete. 132 // complete, and block in this routine until they do complete.
136 void CompleteAllDownloads(Browser* browser) { 133 void CompleteAllDownloads(Browser* browser) {
137 GURL finish_url(URLRequestSlowDownloadJob::kFinishDownloadUrl); 134 GURL finish_url(URLRequestSlowDownloadJob::kFinishDownloadUrl);
138 ui_test_utils::NavigateToURL(browser, finish_url); 135 ui_test_utils::NavigateToURL(browser, finish_url);
139 136
140 // Go through and, for every single profile, wait until there are 137 // Go through and, for every single profile, wait until there are
141 // no active downloads on that download manager. 138 // no active downloads on that download manager.
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 #define MAYBE_DownloadsCloseCheck_5 DownloadsCloseCheck_5 551 #define MAYBE_DownloadsCloseCheck_5 DownloadsCloseCheck_5
555 #endif 552 #endif
556 553
557 IN_PROC_BROWSER_TEST_F(BrowserCloseTest, MAYBE_DownloadsCloseCheck_5) { 554 IN_PROC_BROWSER_TEST_F(BrowserCloseTest, MAYBE_DownloadsCloseCheck_5) {
558 ASSERT_TRUE(SetupForDownloadCloseCheck()); 555 ASSERT_TRUE(SetupForDownloadCloseCheck());
559 for (size_t i = 5 * arraysize(download_close_check_cases) / 6; 556 for (size_t i = 5 * arraysize(download_close_check_cases) / 6;
560 i < 6 * arraysize(download_close_check_cases) / 6; ++i) { 557 i < 6 * arraysize(download_close_check_cases) / 6; ++i) {
561 ExecuteDownloadCloseCheckCase(i); 558 ExecuteDownloadCloseCheckCase(i);
562 } 559 }
563 } 560 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698