| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // #define TEST_REAL_CAPTURE_DEVICE | 53 // #define TEST_REAL_CAPTURE_DEVICE |
| 54 | 54 |
| 55 // Simple class used for dumping video to a file. This can be used for | 55 // Simple class used for dumping video to a file. This can be used for |
| 56 // verifying the output. | 56 // verifying the output. |
| 57 class DumpVideo { | 57 class DumpVideo { |
| 58 public: | 58 public: |
| 59 DumpVideo() : expected_size_(0) {} | 59 DumpVideo() : expected_size_(0) {} |
| 60 void StartDump(int width, int height) { | 60 void StartDump(int width, int height) { |
| 61 base::FilePath file_name = base::FilePath(base::StringPrintf( | 61 base::FilePath file_name = base::FilePath(base::StringPrintf( |
| 62 FILE_PATH_LITERAL("dump_w%d_h%d.yuv"), width, height)); | 62 FILE_PATH_LITERAL("dump_w%d_h%d.yuv"), width, height)); |
| 63 file_.reset(base::OpenFile(file_name, "wb")); | 63 file_.reset(file_util::OpenFile(file_name, "wb")); |
| 64 expected_size_ = media::VideoFrame::AllocationSize( | 64 expected_size_ = media::VideoFrame::AllocationSize( |
| 65 media::VideoFrame::I420, gfx::Size(width, height)); | 65 media::VideoFrame::I420, gfx::Size(width, height)); |
| 66 } | 66 } |
| 67 void NewVideoFrame(const void* buffer) { | 67 void NewVideoFrame(const void* buffer) { |
| 68 if (file_.get() != NULL) { | 68 if (file_.get() != NULL) { |
| 69 ASSERT_EQ(1U, fwrite(buffer, expected_size_, 1, file_.get())); | 69 ASSERT_EQ(1U, fwrite(buffer, expected_size_, 1, file_.get())); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 #ifdef DUMP_VIDEO | 487 #ifdef DUMP_VIDEO |
| 488 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { | 488 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { |
| 489 CaptureAndDumpVideo(640, 480, 30); | 489 CaptureAndDumpVideo(640, 480, 30); |
| 490 } | 490 } |
| 491 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { | 491 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { |
| 492 CaptureAndDumpVideo(1280, 720, 30); | 492 CaptureAndDumpVideo(1280, 720, 30); |
| 493 } | 493 } |
| 494 #endif | 494 #endif |
| 495 | 495 |
| 496 } // namespace content | 496 } // namespace content |
| OLD | NEW |