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); |