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

Side by Side Diff: chrome/test/ui_test_utils.cc

Issue 3071005: Download code cleanup patch of death: (Closed)
Patch Set: inline the dtor Created 10 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
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/test/ui_test_utils.h" 5 #include "chrome/test/ui_test_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 (*it)->AddObserver(this); 161 (*it)->AddObserver(this);
162 still_waiting = true; 162 still_waiting = true;
163 } 163 }
164 } 164 }
165 165
166 if (still_waiting) 166 if (still_waiting)
167 return false; 167 return false;
168 168
169 download_manager_->RemoveObserver(this); 169 download_manager_->RemoveObserver(this);
170 // waiting_ will have been set if not all downloads were complete on first 170 // waiting_ will have been set if not all downloads were complete on first
171 // pass below in SetDownloads(). 171 // pass below in OnSearchDownloadsComplete().
172 if (waiting_) 172 if (waiting_)
173 MessageLoopForUI::current()->Quit(); 173 MessageLoopForUI::current()->Quit();
174 return true; 174 return true;
175 } 175 }
176 176
177 // DownloadItem::Observer 177 // DownloadItem::Observer
178 virtual void OnDownloadUpdated(DownloadItem* download) { 178 virtual void OnDownloadUpdated(DownloadItem* download) {
179 if (download->state() == DownloadItem::COMPLETE) { 179 if (download->state() == DownloadItem::COMPLETE) {
180 CheckAllDownloadsComplete(); 180 CheckAllDownloadsComplete();
181 } 181 }
182 } 182 }
183 183
184 virtual void OnDownloadFileCompleted(DownloadItem* download) { } 184 virtual void OnDownloadFileCompleted(DownloadItem* download) { }
185 virtual void OnDownloadOpened(DownloadItem* download) {} 185 virtual void OnDownloadOpened(DownloadItem* download) {}
186 186
187 // DownloadManager::Observer 187 // DownloadManager::Observer
188 virtual void ModelChanged() { 188 virtual void ModelChanged() {
189 download_manager_->GetDownloads(this, L""); 189 download_manager_->download_history()->Search(
190 string16(),
191 NewCallback(this,
192 &DownloadsCompleteObserver::OnSearchDownloadsComplete));
190 } 193 }
191 194
192 virtual void SetDownloads(std::vector<DownloadItem*>& downloads) { 195 void OnSearchDownloadsComplete(std::vector<DownloadItem*> downloads) {
193 downloads_ = downloads; 196 downloads_ = downloads;
194 if (CheckAllDownloadsComplete()) 197 if (CheckAllDownloadsComplete())
195 return; 198 return;
196 199
197 if (!waiting_) { 200 if (!waiting_) {
198 waiting_ = true; 201 waiting_ = true;
199 ui_test_utils::RunMessageLoop(); 202 ui_test_utils::RunMessageLoop();
200 } 203 }
201 } 204 }
202 205
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 TestWebSocketServer::~TestWebSocketServer() { 663 TestWebSocketServer::~TestWebSocketServer() {
661 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); 664 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine());
662 cmd_line->AppendSwitchWithValue("server", "stop"); 665 cmd_line->AppendSwitchWithValue("server", "stop");
663 cmd_line->AppendSwitch("chromium"); 666 cmd_line->AppendSwitch("chromium");
664 cmd_line->AppendSwitchWithValue("pidfile", 667 cmd_line->AppendSwitchWithValue("pidfile",
665 websocket_pid_file_.ToWStringHack()); 668 websocket_pid_file_.ToWStringHack());
666 base::LaunchApp(*cmd_line.get(), true, false, NULL); 669 base::LaunchApp(*cmd_line.get(), true, false, NULL);
667 } 670 }
668 671
669 } // namespace ui_test_utils 672 } // namespace ui_test_utils
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698