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

Unified Diff: content/public/test/content_browser_test.h

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.cc ('k') | content/public/test/content_browser_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/content_browser_test.h
diff --git a/content/public/test/content_browser_test.h b/content/public/test/content_browser_test.h
index b91b350f9ef4301df4b07dd598687a6eaa06c930..44134f2c0c6373de4f6796311c651a008ee6f733 100644
--- a/content/public/test/content_browser_test.h
+++ b/content/public/test/content_browser_test.h
@@ -11,6 +11,10 @@
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_base.h"
+#if defined(OS_MACOSX)
+#include "base/mac/scoped_nsautorelease_pool.h"
+#endif
+
namespace content {
class Shell;
class ShellMainDelegate;
@@ -26,7 +30,8 @@ class ContentBrowserTest : public BrowserTestBase {
void TearDown() override;
// BrowserTestBase:
- void RunTestOnMainThreadLoop() override;
+ void PreRunTestOnMainThread() override;
+ void PostRunTestOnMainThread() override;
protected:
// Creates a new window and loads about:blank.
@@ -41,6 +46,17 @@ class ContentBrowserTest : public BrowserTestBase {
private:
Shell* shell_;
+#if defined(OS_MACOSX)
+ // On Mac, without the following autorelease pool, code which is directly
+ // executed (as opposed to executed inside a message loop) would autorelease
+ // objects into a higher-level pool. This pool is not recycled in-sync with
+ // the message loops' pools and causes problems with code relying on
+ // 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_ = nullptr;
+#endif
+
#if defined(OS_ANDROID)
// For all other platforms, this is done automatically when calling into
// ContentMain. For Android we set things up manually.
« no previous file with comments | « content/public/test/browser_test_base.cc ('k') | content/public/test/content_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698