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

Unified Diff: content/public/test/browser_test_base.cc

Issue 12188016: Allow BrowserTestBase to do wait. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
Index: content/public/test/browser_test_base.cc
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc
index 5fec23a227cca65f0626c5a7cc1747581394ab9d..d0b83cd090dbd503042b8ed19f7a835cd297dc2b 100644
--- a/content/public/test/browser_test_base.cc
+++ b/content/public/test/browser_test_base.cc
@@ -17,7 +17,9 @@
#endif
#if defined(OS_ANDROID)
+#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_main_runner.h"
+#include "content/public/browser/browser_thread.h"
#endif
namespace {
@@ -59,6 +61,11 @@ BrowserTestBase::BrowserTestBase() {
}
BrowserTestBase::~BrowserTestBase() {
+#if defined(OS_ANDROID)
+ // RemoteTestServer can cause wait on the UI thread.
+ base::ThreadRestrictions::ScopedAllowWait allow_wait;
+ test_server_.reset(NULL);
+#endif
}
void BrowserTestBase::SetUp() {
@@ -79,6 +86,13 @@ void BrowserTestBase::SetUp() {
SetUpInProcessBrowserTestFixture();
#if defined(OS_ANDROID)
BrowserMainRunner::Create()->Initialize(params);
+ // We are done running the test by now. During teardown we
+ // need to be able to perform IO.
+ base::ThreadRestrictions::SetIOAllowed(true);
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
+ true));
#else
BrowserMain(params);
#endif
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | content/shell/android/browsertests_apk/res/layout/test_activity.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698