Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: content/browser/renderer_host/media/video_capture_host_unittest.cc

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Define to use a real video capture device. 47 // Define to use a real video capture device.
48 // #define TEST_REAL_CAPTURE_DEVICE 48 // #define TEST_REAL_CAPTURE_DEVICE
49 49
50 // Simple class used for dumping video to a file. This can be used for 50 // Simple class used for dumping video to a file. This can be used for
51 // verifying the output. 51 // verifying the output.
52 class DumpVideo { 52 class DumpVideo {
53 public: 53 public:
54 DumpVideo() : expected_size_(0) {} 54 DumpVideo() : expected_size_(0) {}
55 void StartDump(int width, int height) { 55 void StartDump(int width, int height) {
56 base::FilePath file_name = base::FilePath( 56 base::FilePath file_name = base::FilePath(base::StringPrintf(
57 StringPrintf(FILE_PATH_LITERAL("dump_w%d_h%d.yuv"), width, height)); 57 FILE_PATH_LITERAL("dump_w%d_h%d.yuv"), width, height));
58 file_.reset(file_util::OpenFile(file_name, "wb")); 58 file_.reset(file_util::OpenFile(file_name, "wb"));
59 expected_size_ = width * height * 3 / 2; 59 expected_size_ = width * height * 3 / 2;
60 } 60 }
61 void NewVideoFrame(const void* buffer) { 61 void NewVideoFrame(const void* buffer) {
62 if (file_.get() != NULL) { 62 if (file_.get() != NULL) {
63 fwrite(buffer, expected_size_, 1, file_.get()); 63 fwrite(buffer, expected_size_, 1, file_.get());
64 } 64 }
65 } 65 }
66 66
67 private: 67 private:
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 #ifdef DUMP_VIDEO 377 #ifdef DUMP_VIDEO
378 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { 378 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) {
379 CaptureAndDumpVideo(640, 480, 30); 379 CaptureAndDumpVideo(640, 480, 30);
380 } 380 }
381 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { 381 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
382 CaptureAndDumpVideo(1280, 720, 30); 382 CaptureAndDumpVideo(1280, 720, 30);
383 } 383 }
384 #endif 384 #endif
385 385
386 } // namespace content 386 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698