| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 virtual void GotFrame( |
| 31 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE { | 31 const scoped_refptr<media::VideoFrame>& frame) override { |
| 32 last_frame_ = frame; | 32 last_frame_ = frame; |
| 33 } | 33 } |
| 34 | 34 |
| 35 const media::VideoFrame* last_frame() { | 35 const media::VideoFrame* last_frame() { |
| 36 return last_frame_.get(); | 36 return last_frame_.get(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 scoped_refptr<media::VideoFrame> last_frame_; | 40 scoped_refptr<media::VideoFrame> last_frame_; |
| 41 }; | 41 }; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 EXPECT_FALSE(handler_->Close(NULL)); | 93 EXPECT_FALSE(handler_->Close(NULL)); |
| 94 EXPECT_TRUE(handler_->Close(&reader)); | 94 EXPECT_TRUE(handler_->Close(&reader)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 TEST_F(VideoSourceHandlerTest, OpenWithoutClose) { | 97 TEST_F(VideoSourceHandlerTest, OpenWithoutClose) { |
| 98 FakeFrameReader reader; | 98 FakeFrameReader reader; |
| 99 EXPECT_TRUE(handler_->Open(kTestStreamUrl, &reader)); | 99 EXPECT_TRUE(handler_->Open(kTestStreamUrl, &reader)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace content | 102 } // namespace content |
| OLD | NEW |