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

Unified Diff: content/public/test/content_browser_test.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
Index: content/public/test/content_browser_test.cc
diff --git a/content/public/test/content_browser_test.cc b/content/public/test/content_browser_test.cc
index c8f358b034f584a76b823aefd0fc9c1a8e065e26..3e49d3081cc120c3e5fbd97304a04ae1e78df63f 100644
--- a/content/public/test/content_browser_test.cc
+++ b/content/public/test/content_browser_test.cc
@@ -10,7 +10,6 @@
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
-#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_paths.h"
@@ -27,10 +26,6 @@
#include "content/shell/app/shell_main_delegate.h"
#endif
-#if defined(OS_MACOSX)
-#include "base/mac/scoped_nsautorelease_pool.h"
-#endif
-
#if !defined(OS_CHROMEOS) && defined(OS_LINUX)
#include "ui/base/ime/input_method_initializer.h"
#endif
@@ -107,7 +102,7 @@ void ContentBrowserTest::TearDown() {
#endif
}
-void ContentBrowserTest::RunTestOnMainThreadLoop() {
+void ContentBrowserTest::PreRunTestOnMainThread() {
if (!switches::IsRunLayoutTestSwitchPresent()) {
CHECK_EQ(Shell::windows().size(), 1u);
shell_ = Shell::windows()[0];
@@ -121,7 +116,7 @@ void ContentBrowserTest::RunTestOnMainThreadLoop() {
// deallocation via an autorelease pool (such as browser window closure and
// browser shutdown). To avoid this, the following pool is recycled after each
// time code is directly executed.
- base::mac::ScopedNSAutoreleasePool pool;
+ pool_ = new base::mac::ScopedNSAutoreleasePool;
#endif
// Pump startup related events.
@@ -129,18 +124,13 @@ void ContentBrowserTest::RunTestOnMainThreadLoop() {
base::RunLoop().RunUntilIdle();
#if defined(OS_MACOSX)
- pool.Recycle();
+ pool_->Recycle();
#endif
+}
- SetUpOnMainThread();
-
- bool old_io_allowed_value = base::ThreadRestrictions::SetIOAllowed(false);
- RunTestOnMainThread();
- base::ThreadRestrictions::SetIOAllowed(old_io_allowed_value);
-
- TearDownOnMainThread();
+void ContentBrowserTest::PostRunTestOnMainThread() {
#if defined(OS_MACOSX)
- pool.Recycle();
+ pool_->Recycle();
#endif
for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
« no previous file with comments | « content/public/test/content_browser_test.h ('k') | extensions/browser/guest_view/web_view/web_view_apitest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698