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

Unified Diff: chrome/test/base/ui_test_utils.cc

Issue 8530003: Delete the temporary file when generating MHTML with the extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor clean-ups Created 9 years, 1 month 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
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(&current_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)

Powered by Google App Engine
This is Rietveld 408576698