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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/child/child_process.h" | 9 #include "content/child/child_process.h" |
10 #include "content/common/media/video_capture.h" | 10 #include "content/common/media/video_capture.h" |
11 #include "content/public/renderer/media_stream_video_sink.h" | 11 #include "content/public/renderer/media_stream_video_sink.h" |
12 #include "content/renderer/media/media_stream.h" | 12 #include "content/renderer/media/media_stream.h" |
13 #include "content/renderer/media/media_stream_registry_interface.h" | 13 #include "content/renderer/media/media_stream_registry_interface.h" |
14 #include "content/renderer/media/mock_media_stream_registry.h" | 14 #include "content/renderer/media/mock_media_stream_registry.h" |
15 #include "content/renderer/media/video_source_handler.h" | 15 #include "content/renderer/media/video_source_handler.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 18 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
19 #include "third_party/WebKit/public/platform/WebString.h" | 19 #include "third_party/WebKit/public/platform/WebString.h" |
20 #include "third_party/WebKit/public/web/WebHeap.h" | 20 #include "third_party/WebKit/public/web/WebHeap.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 static const std::string kTestStreamUrl = "stream_url"; | 24 static const std::string kTestStreamUrl = "stream_url"; |
25 static const std::string kTestVideoTrackId = "video_track_id"; | 25 static const std::string kTestVideoTrackId = "video_track_id"; |
26 static const std::string kUnknownStreamUrl = "unknown_stream_url"; | 26 static const std::string kUnknownStreamUrl = "unknown_stream_url"; |
27 | 27 |
28 class FakeFrameReader : public FrameReaderInterface { | 28 class FakeFrameReader : public FrameReaderInterface { |
29 public: | 29 public: |
30 virtual void GotFrame( | 30 void GotFrame(const scoped_refptr<media::VideoFrame>& frame) override { |
31 const scoped_refptr<media::VideoFrame>& frame) override { | |
32 last_frame_ = frame; | 31 last_frame_ = frame; |
33 } | 32 } |
34 | 33 |
35 const media::VideoFrame* last_frame() { | 34 const media::VideoFrame* last_frame() { |
36 return last_frame_.get(); | 35 return last_frame_.get(); |
37 } | 36 } |
38 | 37 |
39 private: | 38 private: |
40 scoped_refptr<media::VideoFrame> last_frame_; | 39 scoped_refptr<media::VideoFrame> last_frame_; |
41 }; | 40 }; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 EXPECT_FALSE(handler_->Close(NULL)); | 92 EXPECT_FALSE(handler_->Close(NULL)); |
94 EXPECT_TRUE(handler_->Close(&reader)); | 93 EXPECT_TRUE(handler_->Close(&reader)); |
95 } | 94 } |
96 | 95 |
97 TEST_F(VideoSourceHandlerTest, OpenWithoutClose) { | 96 TEST_F(VideoSourceHandlerTest, OpenWithoutClose) { |
98 FakeFrameReader reader; | 97 FakeFrameReader reader; |
99 EXPECT_TRUE(handler_->Open(kTestStreamUrl, &reader)); | 98 EXPECT_TRUE(handler_->Open(kTestStreamUrl, &reader)); |
100 } | 99 } |
101 | 100 |
102 } // namespace content | 101 } // namespace content |
OLD | NEW |