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

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

Issue 1363523002: RenderViewTests: Implement proper shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use EXPECT_EQ instead of DCHECK_EQ. Created 5 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 | « content/public/test/render_view_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/render_view_test.cc
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc
index 30fb8171305333223e30f384e6dbbd1db3925bf9..3bc31c831849cd68fd888061e025b8d940cd98da 100644
--- a/content/public/test/render_view_test.cc
+++ b/content/public/test/render_view_test.cc
@@ -270,19 +270,16 @@ void RenderViewTest::SetUp() {
}
void RenderViewTest::TearDown() {
- // Try very hard to collect garbage before shutting down.
- // "5" was chosen following http://crbug.com/46571#c9
- const int kGCIterations = 5;
- for (int i = 0; i < kGCIterations; i++)
- GetMainFrame()->collectGarbage();
-
// Run the loop so the release task from the renderwidget executes.
ProcessPendingMessages();
- for (int i = 0; i < kGCIterations; i++)
- GetMainFrame()->collectGarbage();
-
render_thread_->SendCloseMessage();
+
+ scoped_ptr<blink::WebLeakDetector> leak_detector =
+ make_scoped_ptr(blink::WebLeakDetector::create(this));
+
+ leak_detector->collectGarbageAndGetDOMCounts(GetMainFrame());
+
view_ = NULL;
mock_process_.reset();
@@ -305,6 +302,18 @@ void RenderViewTest::TearDown() {
command_line_.reset();
}
+void RenderViewTest::onLeakDetectionComplete(const Result& result) {
+ EXPECT_EQ(0u, result.numberOfLiveAudioNodes);
+ EXPECT_EQ(0u, result.numberOfLiveDocuments);
+ EXPECT_EQ(0u, result.numberOfLiveNodes);
+ EXPECT_EQ(0u, result.numberOfLiveLayoutObjects);
+ EXPECT_EQ(0u, result.numberOfLiveResources);
+ EXPECT_EQ(0u, result.numberOfLiveActiveDOMObjects);
+ EXPECT_EQ(0u, result.numberOfLiveScriptPromises);
+ EXPECT_EQ(0u, result.numberOfLiveFrames);
+ EXPECT_EQ(0u, result.numberOfLiveV8PerContextData);
+}
+
void RenderViewTest::SendNativeKeyEvent(
const NativeWebKeyboardEvent& key_event) {
SendWebKeyboardEvent(key_event);
« no previous file with comments | « content/public/test/render_view_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698