diff options
author | tasak@google.com <tasak@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-05 17:50:41 +0000 |
---|---|---|
committer | tasak@google.com <tasak@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-05 17:50:41 +0000 |
commit | b5a18ca0f19958c29a787fe52993b1513774a537 (patch) | |
tree | 0a6ca485950147bf8a3663744e817c0fd642aeb0 /content | |
parent | 6b158a99115a7ff62fa8ca52bf787b8664c61a82 (diff) | |
download | chromium_src-b5a18ca0f19958c29a787fe52993b1513774a537.zip chromium_src-b5a18ca0f19958c29a787fe52993b1513774a537.tar.gz chromium_src-b5a18ca0f19958c29a787fe52993b1513774a537.tar.bz2 |
Added ScopedNSAutoreleasePool to RenderViewTest.
If Blink checks font metrics during some browser_test (e.g. PrintLayoutTest), Blink might allocates CFString by using Mac allocator, and the CFString might have a reference to StringImpl allocated by FastMalloc.
So we should invoke Mac decallocator before destroying Blink instance. If we don't, browser_tests will crash.
BUG=305885, 336756
Review URL: https://codereview.chromium.org/137023014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/public/test/render_view_test.cc | 12 | ||||
-rw-r--r-- | content/public/test/render_view_test.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc index c416114..5de488b 100644 --- a/content/public/test/render_view_test.cc +++ b/content/public/test/render_view_test.cc @@ -28,6 +28,10 @@ #include "ui/base/resource/resource_bundle.h" #include "v8/include/v8.h" +#if defined(OS_MACOSX) +#include "base/mac/scoped_nsautorelease_pool.h" +#endif + using blink::WebFrame; using blink::WebInputEvent; using blink::WebMouseEvent; @@ -143,6 +147,9 @@ void RenderViewTest::SetUp() { render_thread_->set_new_window_routing_id(kNewWindowRouteId); render_thread_->set_new_frame_routing_id(kNewFrameRouteId); +#if defined(OS_MACOSX) + autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); +#endif command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); params_.reset(new MainFunctionParams(*command_line_)); platform_.reset(new RendererMainPlatformDelegate(*params_)); @@ -210,6 +217,11 @@ void RenderViewTest::TearDown() { // (http://crbug.com/21508). base::RunLoop().RunUntilIdle(); +#if defined(OS_MACOSX) + // Needs to run before blink::shutdown(). + autorelease_pool_.reset(NULL); +#endif + blink::shutdown(); platform_->PlatformUninitialize(); diff --git a/content/public/test/render_view_test.h b/content/public/test/render_view_test.h index 204d023..d0e9d0e 100644 --- a/content/public/test/render_view_test.h +++ b/content/public/test/render_view_test.h @@ -139,6 +139,10 @@ class RenderViewTest : public testing::Test { scoped_ptr<MainFunctionParams> params_; scoped_ptr<CommandLine> command_line_; +#if defined(OS_MACOSX) + scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; +#endif + private: void GoToOffset(int offset, const blink::WebHistoryItem& history_item); }; |