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

Side by Side Diff: content/browser/download/download_manager_impl_unittest.cc

Issue 678073006: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bogus formatting Created 6 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 (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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 static const size_t kTestDataLen; 439 static const size_t kTestDataLen;
440 440
441 DownloadManagerTest() 441 DownloadManagerTest()
442 : callback_called_(false), 442 : callback_called_(false),
443 ui_thread_(BrowserThread::UI, &message_loop_), 443 ui_thread_(BrowserThread::UI, &message_loop_),
444 file_thread_(BrowserThread::FILE, &message_loop_), 444 file_thread_(BrowserThread::FILE, &message_loop_),
445 next_download_id_(0) { 445 next_download_id_(0) {
446 } 446 }
447 447
448 // We tear down everything in TearDown(). 448 // We tear down everything in TearDown().
449 virtual ~DownloadManagerTest() {} 449 ~DownloadManagerTest() override {}
450 450
451 // Create a MockDownloadItemFactory and MockDownloadManagerDelegate, 451 // Create a MockDownloadItemFactory and MockDownloadManagerDelegate,
452 // then create a DownloadManager that points 452 // then create a DownloadManager that points
453 // at all of those. 453 // at all of those.
454 virtual void SetUp() { 454 void SetUp() override {
455 DCHECK(!download_manager_); 455 DCHECK(!download_manager_);
456 456
457 mock_download_item_factory_ = (new MockDownloadItemFactory())->AsWeakPtr(); 457 mock_download_item_factory_ = (new MockDownloadItemFactory())->AsWeakPtr();
458 mock_download_file_factory_ = (new MockDownloadFileFactory())->AsWeakPtr(); 458 mock_download_file_factory_ = (new MockDownloadFileFactory())->AsWeakPtr();
459 mock_download_manager_delegate_.reset( 459 mock_download_manager_delegate_.reset(
460 new StrictMock<MockDownloadManagerDelegate>); 460 new StrictMock<MockDownloadManagerDelegate>);
461 EXPECT_CALL(*mock_download_manager_delegate_.get(), Shutdown()) 461 EXPECT_CALL(*mock_download_manager_delegate_.get(), Shutdown())
462 .WillOnce(Return()); 462 .WillOnce(Return());
463 mock_browser_context_.reset(new StrictMock<MockBrowserContext>); 463 mock_browser_context_.reset(new StrictMock<MockBrowserContext>);
464 EXPECT_CALL(*mock_browser_context_.get(), IsOffTheRecord()) 464 EXPECT_CALL(*mock_browser_context_.get(), IsOffTheRecord())
465 .WillRepeatedly(Return(false)); 465 .WillRepeatedly(Return(false));
466 466
467 download_manager_.reset(new DownloadManagerImpl( 467 download_manager_.reset(new DownloadManagerImpl(
468 NULL, mock_browser_context_.get())); 468 NULL, mock_browser_context_.get()));
469 download_manager_->SetDownloadItemFactoryForTesting( 469 download_manager_->SetDownloadItemFactoryForTesting(
470 scoped_ptr<DownloadItemFactory>( 470 scoped_ptr<DownloadItemFactory>(
471 mock_download_item_factory_.get()).Pass()); 471 mock_download_item_factory_.get()).Pass());
472 download_manager_->SetDownloadFileFactoryForTesting( 472 download_manager_->SetDownloadFileFactoryForTesting(
473 scoped_ptr<DownloadFileFactory>( 473 scoped_ptr<DownloadFileFactory>(
474 mock_download_file_factory_.get()).Pass()); 474 mock_download_file_factory_.get()).Pass());
475 observer_.reset(new MockDownloadManagerObserver()); 475 observer_.reset(new MockDownloadManagerObserver());
476 download_manager_->AddObserver(observer_.get()); 476 download_manager_->AddObserver(observer_.get());
477 download_manager_->SetDelegate(mock_download_manager_delegate_.get()); 477 download_manager_->SetDelegate(mock_download_manager_delegate_.get());
478 } 478 }
479 479
480 virtual void TearDown() { 480 void TearDown() override {
481 while (MockDownloadItemImpl* 481 while (MockDownloadItemImpl*
482 item = mock_download_item_factory_->PopItem()) { 482 item = mock_download_item_factory_->PopItem()) {
483 EXPECT_CALL(*item, GetState()) 483 EXPECT_CALL(*item, GetState())
484 .WillOnce(Return(DownloadItem::CANCELLED)); 484 .WillOnce(Return(DownloadItem::CANCELLED));
485 } 485 }
486 EXPECT_CALL(GetMockObserver(), ManagerGoingDown(download_manager_.get())) 486 EXPECT_CALL(GetMockObserver(), ManagerGoingDown(download_manager_.get()))
487 .WillOnce(Return()); 487 .WillOnce(Return());
488 488
489 download_manager_->Shutdown(); 489 download_manager_->Shutdown();
490 download_manager_.reset(); 490 download_manager_.reset();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 .WillOnce(Return()); 680 .WillOnce(Return());
681 EXPECT_CALL(GetMockDownloadItem(3), Remove()) 681 EXPECT_CALL(GetMockDownloadItem(3), Remove())
682 .Times(0); 682 .Times(0);
683 683
684 download_manager_->RemoveAllDownloads(); 684 download_manager_->RemoveAllDownloads();
685 // Because we're mocking the download item, the Remove call doesn't 685 // Because we're mocking the download item, the Remove call doesn't
686 // result in them being removed from the DownloadManager list. 686 // result in them being removed from the DownloadManager list.
687 } 687 }
688 688
689 } // namespace content 689 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_file_unittest.cc ('k') | content/browser/download/drag_download_file_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698