Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / renderer / media / video_source_handler_unittest.cc
index 94dce46..1a5cb78 100644 (file)
@@ -17,6 +17,7 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
 #include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/web/WebHeap.h"
 
 namespace content {
 
@@ -44,17 +45,22 @@ class VideoSourceHandlerTest : public ::testing::Test {
  public:
   VideoSourceHandlerTest()
        : child_process_(new ChildProcess()),
-         registry_() {
-    handler_.reset(new VideoSourceHandler(&registry_));
-    registry_.Init(kTestStreamUrl);
-    registry_.AddVideoTrack(kTestVideoTrackId);
+         registry_(new MockMediaStreamRegistry()) {
+    handler_.reset(new VideoSourceHandler(registry_.get()));
+    registry_->Init(kTestStreamUrl);
+    registry_->AddVideoTrack(kTestVideoTrackId);
+  }
+
+  virtual void TearDown() {
+    registry_.reset();
+    blink::WebHeap::collectAllGarbageForTesting();
   }
 
  protected:
   base::MessageLoop message_loop_;
   scoped_ptr<ChildProcess> child_process_;
   scoped_ptr<VideoSourceHandler> handler_;
-  MockMediaStreamRegistry registry_;
+  scoped_ptr<MockMediaStreamRegistry> registry_;
 };
 
 TEST_F(VideoSourceHandlerTest, OpenClose) {