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

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

Issue 8274012: Wait for URLBlacklist update tasks on automation tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added BrowserThread::WaitForPendingTasksOn, removed SignalingTask Created 9 years, 2 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/browser/extensions/test_extension_prefs.cc » ('j') | content/browser/browser_thread.h » ('J')
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 50faa3c661a01925dc8d344aa34343863ecf1a71..d4f7d8701985ed09dbc1d0ef40e915cd26b9798b 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -2733,12 +2733,10 @@ namespace {
// Used by AutomationProvider::GetBrowserInfo().
class GetChildProcessHostInfoTask : public Task {
public:
- GetChildProcessHostInfoTask(base::WaitableEvent* event,
- ListValue* child_processes)
- : event_(event),
- child_processes_(child_processes) {}
+ explicit GetChildProcessHostInfoTask(ListValue* child_processes)
+ : child_processes_(child_processes) {}
- virtual void Run() {
+ virtual void Run() OVERRIDE {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) {
// Only add processes which are already started,
@@ -2754,11 +2752,9 @@ class GetChildProcessHostInfoTask : public Task {
item->SetInteger("pid", base::GetProcId(info->handle()));
child_processes_->Append(item);
}
- event_->Signal();
}
private:
- base::WaitableEvent* const event_; // weak
ListValue* child_processes_;
DISALLOW_COPY_AND_ASSIGN(GetChildProcessHostInfoTask);
@@ -2880,12 +2876,10 @@ void TestingAutomationProvider::GetBrowserInfo(
// Add all child processes in a list of dictionaries, one dictionary item
// per child process.
ListValue* child_processes = new ListValue;
- base::WaitableEvent event(true /* manual reset */,
- false /* not initially signaled */);
CHECK(BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- new GetChildProcessHostInfoTask(&event, child_processes)));
- event.Wait();
+ new GetChildProcessHostInfoTask(child_processes)));
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::IO));
return_value->Set("child_processes", child_processes);
// Add all extension processes in a list of dictionaries, one dictionary
@@ -5899,6 +5893,14 @@ void TestingAutomationProvider::SetPolicies(
}
}
+ // OverridePolicies() triggers preference updates, which triggers preference
+ // listeners. Some policies (e.g. URLBlacklist) post tasks to other message
+ // loops before they start being enforced; make sure those tasks have
+ // finished.
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::IO));
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::FILE));
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::IO));
+
reply.SendSuccess(NULL);
#endif // defined(OFFICIAL_BUILD)
}
« no previous file with comments | « no previous file | chrome/browser/extensions/test_extension_prefs.cc » ('j') | content/browser/browser_thread.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698