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

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

Issue 2832153003: Move calling of shared browser test methods like SetUpOnMainThread/TearDownOnMainThread/RunTestOn... (Closed)
Patch Set: sync Created 3 years, 8 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 | « content/public/test/browser_test_base.h ('k') | content/public/test/content_browser_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a562bf0d663a94bc5d2ad41ed10f02c24b0dffdf..20b2bff184def651157b5dce54163c21fac36ef6 100644
--- a/content/public/test/browser_test_base.cc
+++ b/content/public/test/browser_test_base.cc
@@ -18,6 +18,7 @@
#include "base/sys_info.h"
#include "base/test/test_timeouts.h"
#include "base/threading/sequenced_worker_pool.h"
+#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/tracing/tracing_controller_impl.h"
@@ -145,7 +146,8 @@ BrowserTestBase::BrowserTestBase()
: expected_exit_code_(0),
enable_pixel_output_(false),
use_software_compositing_(false),
- set_up_called_(false) {
+ set_up_called_(false),
+ disable_io_checks_(false) {
#if defined(OS_MACOSX)
base::mac::SetOverrideAmIBundled(true);
#endif
@@ -343,7 +345,16 @@ void BrowserTestBase::ProxyRunTestOnMainThreadLoop() {
// waiting.
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
- RunTestOnMainThreadLoop();
+ PreRunTestOnMainThread();
+ SetUpOnMainThread();
+ bool old_io_allowed_value = false;
+ if (!disable_io_checks_)
+ base::ThreadRestrictions::SetIOAllowed(false);
+ RunTestOnMainThread();
+ if (!disable_io_checks_)
+ base::ThreadRestrictions::SetIOAllowed(old_io_allowed_value);
+ TearDownOnMainThread();
+ PostRunTestOnMainThread();
}
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
« no previous file with comments | « content/public/test/browser_test_base.h ('k') | content/public/test/content_browser_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698