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

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

Issue 1091093006: Update {virtual,override} to follow C++11 style in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Back out some webrtc files. Created 5 years, 8 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
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return 0; 173 return 0;
174 std::map<int, base::SharedMemory*>::iterator it = filled_dib_.begin(); 174 std::map<int, base::SharedMemory*>::iterator it = filled_dib_.begin();
175 int h = it->first; 175 int h = it->first;
176 delete it->second; 176 delete it->second;
177 filled_dib_.erase(it); 177 filled_dib_.erase(it);
178 178
179 return h; 179 return h;
180 } 180 }
181 181
182 private: 182 private:
183 virtual ~MockVideoCaptureHost() { 183 ~MockVideoCaptureHost() override {
184 STLDeleteContainerPairSecondPointers(filled_dib_.begin(), 184 STLDeleteContainerPairSecondPointers(filled_dib_.begin(),
185 filled_dib_.end()); 185 filled_dib_.end());
186 } 186 }
187 187
188 // This method is used to dispatch IPC messages to the renderer. We intercept 188 // This method is used to dispatch IPC messages to the renderer. We intercept
189 // these messages here and dispatch to our mock methods to verify the 189 // these messages here and dispatch to our mock methods to verify the
190 // conversation between this object and the renderer. 190 // conversation between this object and the renderer.
191 virtual bool Send(IPC::Message* message) override { 191 bool Send(IPC::Message* message) override {
192 CHECK(message); 192 CHECK(message);
193 193
194 // In this method we dispatch the messages to the according handlers as if 194 // In this method we dispatch the messages to the according handlers as if
195 // we are the renderer. 195 // we are the renderer.
196 bool handled = true; 196 bool handled = true;
197 IPC_BEGIN_MESSAGE_MAP(MockVideoCaptureHost, *message) 197 IPC_BEGIN_MESSAGE_MAP(MockVideoCaptureHost, *message)
198 IPC_MESSAGE_HANDLER(VideoCaptureMsg_NewBuffer, OnNewBufferCreatedDispatch) 198 IPC_MESSAGE_HANDLER(VideoCaptureMsg_NewBuffer, OnNewBufferCreatedDispatch)
199 IPC_MESSAGE_HANDLER(VideoCaptureMsg_FreeBuffer, OnBufferFreedDispatch) 199 IPC_MESSAGE_HANDLER(VideoCaptureMsg_FreeBuffer, OnBufferFreedDispatch)
200 IPC_MESSAGE_HANDLER(VideoCaptureMsg_BufferReady, OnBufferFilledDispatch) 200 IPC_MESSAGE_HANDLER(VideoCaptureMsg_BufferReady, OnBufferFilledDispatch)
201 IPC_MESSAGE_HANDLER(VideoCaptureMsg_MailboxBufferReady, 201 IPC_MESSAGE_HANDLER(VideoCaptureMsg_MailboxBufferReady,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // This is an integration test of VideoCaptureHost in conjunction with 279 // This is an integration test of VideoCaptureHost in conjunction with
280 // MediaStreamManager, VideoCaptureManager, VideoCaptureController, and 280 // MediaStreamManager, VideoCaptureManager, VideoCaptureController, and
281 // VideoCaptureDevice. 281 // VideoCaptureDevice.
282 class VideoCaptureHostTest : public testing::Test { 282 class VideoCaptureHostTest : public testing::Test {
283 public: 283 public:
284 VideoCaptureHostTest() 284 VideoCaptureHostTest()
285 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 285 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
286 message_loop_(base::MessageLoopProxy::current()), 286 message_loop_(base::MessageLoopProxy::current()),
287 opened_session_id_(kInvalidMediaCaptureSessionId) {} 287 opened_session_id_(kInvalidMediaCaptureSessionId) {}
288 288
289 virtual void SetUp() override { 289 void SetUp() override {
290 SetBrowserClientForTesting(&browser_client_); 290 SetBrowserClientForTesting(&browser_client_);
291 291
292 #if defined(OS_CHROMEOS) 292 #if defined(OS_CHROMEOS)
293 chromeos::CrasAudioHandler::InitializeForTesting(); 293 chromeos::CrasAudioHandler::InitializeForTesting();
294 #endif 294 #endif
295 295
296 // Create our own MediaStreamManager. 296 // Create our own MediaStreamManager.
297 audio_manager_.reset(media::AudioManager::CreateForTesting()); 297 audio_manager_.reset(media::AudioManager::CreateForTesting());
298 #ifndef TEST_REAL_CAPTURE_DEVICE 298 #ifndef TEST_REAL_CAPTURE_DEVICE
299 base::CommandLine::ForCurrentProcess()->AppendSwitch( 299 base::CommandLine::ForCurrentProcess()->AppendSwitch(
300 switches::kUseFakeDeviceForMediaStream); 300 switches::kUseFakeDeviceForMediaStream);
301 #endif 301 #endif
302 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get())); 302 media_stream_manager_.reset(new MediaStreamManager(audio_manager_.get()));
303 media_stream_manager_->UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy>()); 303 media_stream_manager_->UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy>());
304 304
305 // Create a Host and connect it to a simulated IPC channel. 305 // Create a Host and connect it to a simulated IPC channel.
306 host_ = new MockVideoCaptureHost(media_stream_manager_.get()); 306 host_ = new MockVideoCaptureHost(media_stream_manager_.get());
307 host_->OnChannelConnected(base::GetCurrentProcId()); 307 host_->OnChannelConnected(base::GetCurrentProcId());
308 308
309 OpenSession(); 309 OpenSession();
310 } 310 }
311 311
312 virtual void TearDown() override { 312 void TearDown() override {
313 // Verifies and removes the expectations on host_ and 313 // Verifies and removes the expectations on host_ and
314 // returns true iff successful. 314 // returns true iff successful.
315 Mock::VerifyAndClearExpectations(host_.get()); 315 Mock::VerifyAndClearExpectations(host_.get());
316 EXPECT_EQ(0u, host_->entries_.size()); 316 EXPECT_EQ(0u, host_->entries_.size());
317 317
318 CloseSession(); 318 CloseSession();
319 319
320 // Simulate closing the IPC sender. 320 // Simulate closing the IPC sender.
321 host_->OnChannelClosing(); 321 host_->OnChannelClosing();
322 322
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 #ifdef DUMP_VIDEO 560 #ifdef DUMP_VIDEO
561 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) { 561 TEST_F(VideoCaptureHostTest, CaptureAndDumpVideoVga) {
562 CaptureAndDumpVideo(640, 480, 30); 562 CaptureAndDumpVideo(640, 480, 30);
563 } 563 }
564 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) { 564 TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
565 CaptureAndDumpVideo(1280, 720, 30); 565 CaptureAndDumpVideo(1280, 720, 30);
566 } 566 }
567 #endif 567 #endif
568 568
569 } // namespace content 569 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698