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

Unified Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 7544026: Fix for flakiness in pyauto automation hook WaitForDownloadsToComplete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/testing_automation_provider.cc
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index d892388f609154fc306b555b959c284e1a0b3004..306b9a67341d73cfdbbe76f27549fae0ba62ecd0 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -2942,10 +2942,18 @@ void TestingAutomationProvider::WaitForDownloadsToComplete(
new AutomationProviderDownloadItemObserver(
this, reply_message, downloads.size());
for (std::vector<DownloadItem*>::iterator i = downloads.begin();
- i != downloads.end();
- i++) {
+ i != downloads.end(); ++i) {
(*i)->AddObserver(item_observer);
}
+ // It's possible that pending downloads may have completed before the observer
Paweł Hajdan Jr. 2011/08/01 22:42:10 Seems hacky. How about starting the new download o
Nirnimesh 2011/08/01 22:49:24 In a perfect world, yes. But the flakes in the dow
dennis_jeffrey 2011/08/02 00:04:53 The suggested approach works well in the case wher
Paweł Hajdan Jr. 2011/08/02 16:53:23 Please show me the bugs and I can fix them. Let's
Paweł Hajdan Jr. 2011/08/02 16:53:23 This is a known problem with pyauto. I see the fol
+ // above has been completely set up. Handle this case by checking again and
+ // returning if there are no pending downloads.
+ browser->profile()->GetDownloadManager()->
+ GetCurrentDownloads(FilePath(), &downloads);
+ if (downloads.empty()) {
+ delete item_observer;
+ AutomationJSONReply(this, reply_message).SendSuccess(NULL);
+ }
}
namespace {
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698