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

Unified Diff: chrome/test/render_view_test.cc

Issue 240001: Force garbage collection after running any unit tests that initialize WebViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | « chrome/renderer/extensions/json_schema_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/render_view_test.cc
===================================================================
--- chrome/test/render_view_test.cc (revision 27159)
+++ chrome/test/render_view_test.cc (working copy)
@@ -20,6 +20,7 @@
#include "webkit/api/public/WebScriptSource.h"
#include "webkit/api/public/WebURLRequest.h"
#include "webkit/glue/webview.h"
+#include "webkit/glue/webkit_glue.h"
using WebKit::WebFrame;
using WebKit::WebScriptSource;
@@ -68,6 +69,9 @@
platform_.reset(new RendererMainPlatformDelegate(*params_));
platform_->PlatformInitialize();
+ // Setting flags and really doing anything with WebKit is fairly fragile and
+ // hacky, but this is the world we live in...
+ webkit_glue::SetJavaScriptFlags(L" --expose-gc");
WebKit::initialize(&webkitclient_);
WebKit::registerExtension(BaseJsV8Extension::Get());
WebKit::registerExtension(JsonSchemaJsV8Extension::Get());
@@ -100,6 +104,10 @@
mock_keyboard_.reset(new MockKeyboard());
}
void RenderViewTest::TearDown() {
+ // Try very hard to collect garbage before shutting down.
+ GetMainFrame()->collectGarbage();
+ GetMainFrame()->collectGarbage();
+
render_thread_.SendCloseMessage();
// Run the loop so the release task from the renderwidget executes.
« no previous file with comments | « chrome/renderer/extensions/json_schema_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698