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

Side by Side Diff: media/capture/video/fake_video_capture_device_unittest.cc

Issue 1418263006: Extend VideoCaptureDevice::Client::OnError() to have a tracked_objects::Location param. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #endif 47 #endif
48 48
49 private: 49 private:
50 const int id_; 50 const int id_;
51 const size_t mapped_size_; 51 const size_t mapped_size_;
52 uint8* const data_; 52 uint8* const data_;
53 }; 53 };
54 54
55 class MockClient : public VideoCaptureDevice::Client { 55 class MockClient : public VideoCaptureDevice::Client {
56 public: 56 public:
57 MOCK_METHOD1(OnError, void(const std::string& reason)); 57 MOCK_METHOD2(OnError,
58 void(const tracked_objects::Location& from_here,
59 const std::string& reason));
58 60
59 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) 61 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb)
60 : frame_cb_(frame_cb) {} 62 : frame_cb_(frame_cb) {}
61 63
62 // Client virtual methods for capturing using Device Buffers. 64 // Client virtual methods for capturing using Device Buffers.
63 void OnIncomingCapturedData(const uint8* data, 65 void OnIncomingCapturedData(const uint8* data,
64 int length, 66 int length,
65 const VideoCaptureFormat& format, 67 const VideoCaptureFormat& format,
66 int rotation, 68 int rotation,
67 const base::TimeTicks& timestamp) { 69 const base::TimeTicks& timestamp) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 protected: 136 protected:
135 FakeVideoCaptureDeviceBase() 137 FakeVideoCaptureDeviceBase()
136 : loop_(new base::MessageLoop()), 138 : loop_(new base::MessageLoop()),
137 client_(new MockClient( 139 client_(new MockClient(
138 base::Bind(&FakeVideoCaptureDeviceBase::OnFrameCaptured, 140 base::Bind(&FakeVideoCaptureDeviceBase::OnFrameCaptured,
139 base::Unretained(this)))), 141 base::Unretained(this)))),
140 video_capture_device_factory_(new FakeVideoCaptureDeviceFactory()) { 142 video_capture_device_factory_(new FakeVideoCaptureDeviceFactory()) {
141 device_enumeration_listener_ = new DeviceEnumerationListener(); 143 device_enumeration_listener_ = new DeviceEnumerationListener();
142 } 144 }
143 145
144 void SetUp() override { EXPECT_CALL(*client_, OnError(_)).Times(0); } 146 void SetUp() override { EXPECT_CALL(*client_, OnError(_, _)).Times(0); }
145 147
146 void OnFrameCaptured(const VideoCaptureFormat& format) { 148 void OnFrameCaptured(const VideoCaptureFormat& format) {
147 last_format_ = format; 149 last_format_ = format;
148 run_loop_->QuitClosure().Run(); 150 run_loop_->QuitClosure().Run();
149 } 151 }
150 152
151 void WaitForCapturedFrame() { 153 void WaitForCapturedFrame() {
152 run_loop_.reset(new base::RunLoop()); 154 run_loop_.reset(new base::RunLoop());
153 run_loop_->Run(); 155 run_loop_->Run();
154 } 156 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 278 }
277 } 279 }
278 280
279 INSTANTIATE_TEST_CASE_P(, 281 INSTANTIATE_TEST_CASE_P(,
280 FakeVideoCaptureDeviceCommandLineTest, 282 FakeVideoCaptureDeviceCommandLineTest,
281 Values(CommandLineTestData{"fps=-1", 5}, 283 Values(CommandLineTestData{"fps=-1", 5},
282 CommandLineTestData{"fps=29.97", 29.97}, 284 CommandLineTestData{"fps=29.97", 29.97},
283 CommandLineTestData{"fps=60", 60}, 285 CommandLineTestData{"fps=60", 60},
284 CommandLineTestData{"fps=1000", 60})); 286 CommandLineTestData{"fps=1000", 60}));
285 }; // namespace media 287 }; // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698