Index: chrome/test/base/ui_test_utils.cc |
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc |
index 5097b050a861de09e569222483ce50f758873a7d..7ce64887a4d4514663767e5af76399c8df5cd264 100644 |
--- a/chrome/test/base/ui_test_utils.cc |
+++ b/chrome/test/base/ui_test_utils.cc |
@@ -228,6 +228,17 @@ bool ExecuteJavaScriptHelper(RenderViewHost* render_view_host, |
return true; |
} |
+void RunAllPendingMessageAndSendQuit(content::BrowserThread::ID thread_id) { |
+ MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
sky
2011/11/18 23:24:56
Can you use RunAllPendingInMessageLoop again here?
Jay Civelli
2011/11/19 00:01:12
Done.
|
+ MessageLoop* loop = MessageLoop::current(); |
+ bool did_allow_task_nesting = loop->NestableTasksAllowed(); |
+ loop->SetNestableTasksAllowed(true); |
+ loop->Run(); |
+ loop->SetNestableTasksAllowed(did_allow_task_nesting); |
+ content::BrowserThread::PostTask(thread_id, FROM_HERE, |
+ new MessageLoop::QuitTask()); |
+} |
+ |
} // namespace |
void RunMessageLoop() { |
@@ -252,6 +263,23 @@ void RunAllPendingInMessageLoop() { |
ui_test_utils::RunMessageLoop(); |
} |
+void RunAllPendingInMessageLoop(content::BrowserThread::ID thread_id) { |
+ if (content::BrowserThread::CurrentlyOn(thread_id)) { |
+ RunAllPendingInMessageLoop(); |
+ return; |
+ } |
+ content::BrowserThread::ID current_thread_id; |
+ if (!content::BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id)) { |
+ NOTREACHED(); |
+ return; |
+ } |
+ content::BrowserThread::PostTask(thread_id, FROM_HERE, |
+ base::Bind(&RunAllPendingMessageAndSendQuit, current_thread_id)); |
+ |
+ ui_test_utils::RunMessageLoop(); |
+} |
+ |
sky
2011/11/18 23:24:56
nit: remove line.
Jay Civelli
2011/11/19 00:01:12
Done.
|
+ |
bool GetCurrentTabTitle(const Browser* browser, string16* title) { |
TabContents* tab_contents = browser->GetSelectedTabContents(); |
if (!tab_contents) |