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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc

Issue 703463006: Fix DCHECK when shutting down safe browsing DownloadMetadataManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/download_metadata_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc
index 1539fe025d572886a7ea71240a6b5e8b6f849439..071ec3c591ee2ce443b7a14548e189a1e5fb33aa 100644
--- a/chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/download_metadata_manager_unittest.cc
@@ -180,6 +180,14 @@ class DownloadMetadataManagerTestBase : public ::testing::Test {
void ShutdownDownloadManager() {
if (dm_observer_) {
dm_observer_->ManagerGoingDown(&download_manager_);
+ // Note: these calls may result in "Uninteresting mock function call"
+ // warnings as a result of MockDownloadItem invoking observers in its
+ // dtor. This happens after the NiceMock wrapper has removed its niceness
+ // hook. These can safely be ignored, as they are entirely expected. The
+ // values specified by ON_CALL invocations in AddDownloadItems are
+ // returned as desired.
robertshield 2014/11/05 01:04:50 I don't know enough gmock to know whether this is
grt (UTC plus 2) 2014/11/05 01:25:35 The right thing when you don't want an expectation
+ other_item_.reset();
+ test_item_.reset();
dm_observer_ = nullptr;
}
}
@@ -208,13 +216,6 @@ class DownloadMetadataManagerTestBase : public ::testing::Test {
dm_observer_->OnDownloadCreated(&download_manager_, other_item_.get());
}
- // Destroyes the DownloadItems added to the manager. Safe to call any number
- // of times.
- void DestroyDownloadItems() {
- other_item_.reset();
- test_item_.reset();
- }
-
content::TestBrowserThreadBundle thread_bundle_;
NiceMock<MockDownloadMetadataManager> manager_;
TestingProfile profile_;
@@ -329,17 +330,14 @@ TEST_P(GetDetailsTest, GetDownloadDetails) {
// Fire in the hole!
manager_.GetDownloadDetails(&profile_, details_getter.GetCallback());
- // Destroy download items and shutdown the download manager, if relevant.
- if (early_shutdown_) {
- DestroyDownloadItems();
+ // Shutdown the download manager, if relevant.
+ if (early_shutdown_)
ShutdownDownloadManager();
- }
// Allow the read task and the response callback to run.
RunAllTasks();
- // Destroy download items and shutdown the download manager, if relevant.
- DestroyDownloadItems();
+ // Shutdown the download manager, if relevant.
ShutdownDownloadManager();
}
@@ -464,7 +462,6 @@ TEST_P(SetRequestTest, SetRequest) {
}
manager_.GetDownloadDetails(&profile_, details_getter.GetCallback());
- DestroyDownloadItems();
ShutdownDownloadManager();
scoped_ptr<DownloadMetadata> metadata(ReadTestMetadataFile());
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/download_metadata_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698