OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
11 #include "content/renderer/media/media_stream.h" | 11 #include "content/renderer/media/media_stream.h" |
12 #include "content/renderer/media/media_stream_video_track.h" | 12 #include "content/renderer/media/media_stream_video_track.h" |
13 #include "content/renderer/media/mock_media_stream_registry.h" | 13 #include "content/renderer/media/mock_media_stream_registry.h" |
14 #include "content/renderer/media/mock_media_stream_video_sink.h" | 14 #include "content/renderer/media/mock_media_stream_video_sink.h" |
15 #include "content/renderer/media/webrtc/video_destination_handler.h" | 15 #include "content/renderer/media/webrtc/video_destination_handler.h" |
16 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 16 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
17 #include "content/renderer/pepper/ppb_image_data_impl.h" | 17 #include "content/renderer/pepper/ppb_image_data_impl.h" |
18 #include "content/test/ppapi_unittest.h" | 18 #include "content/test/ppapi_unittest.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
22 #include "third_party/WebKit/public/platform/WebString.h" | 22 #include "third_party/WebKit/public/platform/WebString.h" |
| 23 #include "third_party/WebKit/public/web/WebHeap.h" |
23 | 24 |
24 using ::testing::_; | 25 using ::testing::_; |
25 | 26 |
26 namespace content { | 27 namespace content { |
27 | 28 |
28 ACTION_P(RunClosure, closure) { | 29 ACTION_P(RunClosure, closure) { |
29 closure.Run(); | 30 closure.Run(); |
30 } | 31 } |
31 | 32 |
32 static const std::string kTestStreamUrl = "stream_url"; | 33 static const std::string kTestStreamUrl = "stream_url"; |
33 static const std::string kUnknownStreamUrl = "unknown_stream_url"; | 34 static const std::string kUnknownStreamUrl = "unknown_stream_url"; |
34 | 35 |
35 class VideoDestinationHandlerTest : public PpapiUnittest { | 36 class VideoDestinationHandlerTest : public PpapiUnittest { |
36 public: | 37 public: |
37 VideoDestinationHandlerTest() | 38 VideoDestinationHandlerTest() |
38 : child_process_(new ChildProcess()), | 39 : child_process_(new ChildProcess()), |
39 registry_(new MockMediaStreamRegistry()) { | 40 registry_(new MockMediaStreamRegistry()) { |
40 registry_->Init(kTestStreamUrl); | 41 registry_->Init(kTestStreamUrl); |
41 } | 42 } |
42 | 43 |
43 virtual void TearDown() { | 44 virtual void TearDown() OVERRIDE { |
44 registry_.reset(); | 45 registry_.reset(); |
| 46 blink::WebHeap::collectAllGarbageForTesting(); |
45 PpapiUnittest::TearDown(); | 47 PpapiUnittest::TearDown(); |
46 } | 48 } |
47 | 49 |
48 base::MessageLoop* io_message_loop() const { | 50 base::MessageLoop* io_message_loop() const { |
49 return child_process_->io_message_loop(); | 51 return child_process_->io_message_loop(); |
50 } | 52 } |
51 | 53 |
52 protected: | 54 protected: |
53 scoped_ptr<ChildProcess> child_process_; | 55 scoped_ptr<ChildProcess> child_process_; |
54 scoped_ptr<MockMediaStreamRegistry> registry_; | 56 scoped_ptr<MockMediaStreamRegistry> registry_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // TODO(perkj): Verify that the track output I420 when | 102 // TODO(perkj): Verify that the track output I420 when |
101 // https://codereview.chromium.org/213423006/ is landed. | 103 // https://codereview.chromium.org/213423006/ is landed. |
102 EXPECT_EQ(1, sink.number_of_frames()); | 104 EXPECT_EQ(1, sink.number_of_frames()); |
103 native_track->RemoveSink(&sink); | 105 native_track->RemoveSink(&sink); |
104 | 106 |
105 // The |frame_writer| is a proxy and is owned by whoever call Open. | 107 // The |frame_writer| is a proxy and is owned by whoever call Open. |
106 delete frame_writer; | 108 delete frame_writer; |
107 } | 109 } |
108 | 110 |
109 } // namespace content | 111 } // namespace content |
OLD | NEW |