OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/scoped_file.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "content/browser/browser_thread_impl.h" | 16 #include "content/browser/browser_thread_impl.h" |
16 #include "content/browser/renderer_host/media/media_stream_manager.h" | 17 #include "content/browser/renderer_host/media/media_stream_manager.h" |
17 #include "content/browser/renderer_host/media/media_stream_requester.h" | 18 #include "content/browser/renderer_host/media/media_stream_requester.h" |
18 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 19 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
19 #include "content/browser/renderer_host/media/video_capture_host.h" | 20 #include "content/browser/renderer_host/media/video_capture_host.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 expected_size_ = media::VideoFrame::AllocationSize( | 65 expected_size_ = media::VideoFrame::AllocationSize( |
65 media::VideoFrame::I420, gfx::Size(width, height)); | 66 media::VideoFrame::I420, gfx::Size(width, height)); |
66 } | 67 } |
67 void NewVideoFrame(const void* buffer) { | 68 void NewVideoFrame(const void* buffer) { |
68 if (file_.get() != NULL) { | 69 if (file_.get() != NULL) { |
69 ASSERT_EQ(1U, fwrite(buffer, expected_size_, 1, file_.get())); | 70 ASSERT_EQ(1U, fwrite(buffer, expected_size_, 1, file_.get())); |
70 } | 71 } |
71 } | 72 } |
72 | 73 |
73 private: | 74 private: |
74 file_util::ScopedFILE file_; | 75 base::ScopedFILE file_; |
75 int expected_size_; | 76 int expected_size_; |
76 }; | 77 }; |
77 | 78 |
78 class MockMediaStreamRequester : public MediaStreamRequester { | 79 class MockMediaStreamRequester : public MediaStreamRequester { |
79 public: | 80 public: |
80 MockMediaStreamRequester() {} | 81 MockMediaStreamRequester() {} |
81 virtual ~MockMediaStreamRequester() {} | 82 virtual ~MockMediaStreamRequester() {} |
82 | 83 |
83 // MediaStreamRequester implementation. | 84 // MediaStreamRequester implementation. |
84 MOCK_METHOD5(StreamGenerated, | 85 MOCK_METHOD5(StreamGenerated, |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 #ifdef DUMP_VIDEO | 529 #ifdef DUMP_VIDEO |
529 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { | 530 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { |
530 CaptureAndDumpVideo(640, 480, 30); | 531 CaptureAndDumpVideo(640, 480, 30); |
531 } | 532 } |
532 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { | 533 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { |
533 CaptureAndDumpVideo(1280, 720, 30); | 534 CaptureAndDumpVideo(1280, 720, 30); |
534 } | 535 } |
535 #endif | 536 #endif |
536 | 537 |
537 } // namespace content | 538 } // namespace content |
OLD | NEW |