summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/download/download_manager.cc15
-rw-r--r--chrome/browser/download/download_manager_unittest.cc6
-rw-r--r--tools/heapcheck/suppressions.txt43
-rw-r--r--tools/valgrind/memcheck/suppressions.txt15
4 files changed, 11 insertions, 68 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 6930755..ed83daf 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -631,22 +631,21 @@ void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info,
// - incognito mode (that is the point of this mode)
// - extensions (users don't think of extension installation as 'downloading')
// - temporary download, like in drag-and-drop
+ // - history service is not available (e.g. in tests)
// We have to make sure that these handles don't collide with normal db
// handles, so we use a negative value. Eventually, they could overlap, but
// you'd have to do enough downloading that your ISP would likely stab you in
// the neck first. YMMV.
+ // FIXME(paulg) see bug 958058. EXPLICIT_ACCESS below is wrong.
+ HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
if (download->is_otr() || download->is_extension_install() ||
- download->is_temporary()) {
+ download->is_temporary() || !hs) {
OnCreateDownloadEntryComplete(*info, fake_db_handle_.GetNext());
} else {
// Update the history system with the new download.
- // FIXME(paulg) see bug 958058. EXPLICIT_ACCESS below is wrong.
- HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
- if (hs) {
- hs->CreateDownload(
- *info, &cancelable_consumer_,
- NewCallback(this, &DownloadManager::OnCreateDownloadEntryComplete));
- }
+ hs->CreateDownload(
+ *info, &cancelable_consumer_,
+ NewCallback(this, &DownloadManager::OnCreateDownloadEntryComplete));
}
UpdateAppIcon();
diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc
index c221a5d..827cae1 100644
--- a/chrome/browser/download/download_manager_unittest.cc
+++ b/chrome/browser/download/download_manager_unittest.cc
@@ -59,7 +59,9 @@ class DownloadManagerTest : public testing::Test {
~DownloadManagerTest() {
// profile_ must outlive download_manager_, so we explicitly delete
// download_manager_ first.
- download_manager_.release();
+ download_manager_ = NULL;
+ profile_.reset(NULL);
+ message_loop_.RunAllPending();
}
void GetGeneratedFilename(const std::string& content_disposition,
@@ -763,7 +765,7 @@ const struct {
class MockDownloadFile : public DownloadFile {
public:
- MockDownloadFile(DownloadCreateInfo* info)
+ explicit MockDownloadFile(DownloadCreateInfo* info)
: DownloadFile(info), renamed_count_(0) { }
virtual ~MockDownloadFile() { Destructed(); }
MOCK_METHOD2(Rename, bool(const FilePath&, bool));
diff --git a/tools/heapcheck/suppressions.txt b/tools/heapcheck/suppressions.txt
index 3186131..e8ac717 100644
--- a/tools/heapcheck/suppressions.txt
+++ b/tools/heapcheck/suppressions.txt
@@ -893,49 +893,6 @@
fun:disk_cache::BackendImpl::MatchEntry
}
{
- bug_49307_a
- Heapcheck:Leak
- ...
- fun:DownloadManagerTest
- fun:DownloadManagerTest_TestDownloadFilename_Test
-}
-{
- bug_49307_b
- Heapcheck:Leak
- ...
- fun:DownloadManagerTest
- fun:DownloadManagerTest_StartDownload_Test
-}
-{
- bug_49307_c
- Heapcheck:Leak
- ...
- fun:DownloadManager::OpenFilesBasedOnExtension
- fun:DownloadManagerTest_StartDownload_Test::TestBody
-}
-{
- bug_49307_d
- Heapcheck:Leak
- ...
- fun:DownloadManager::ContinueStartDownload
- fun:DownloadManager::FileSelected
- fun:DownloadManagerTest_DownloadRenameTest_Test::TestBody
-}
-{
- bug_49307_e
- Heapcheck:Leak
- ...
- fun:DownloadManagerTest
- fun:DownloadManagerTest_DownloadRenameTest_Test
-}
-{
- bug_49307_f
- Heapcheck:Leak
- ...
- fun:DownloadManager::DownloadFinished
- fun:DownloadManagerTest_DownloadRenameTest_Test::TestBody
-}
-{
bug_49310_a
Heapcheck:Leak
...
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index aeea513..2c3f736 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -3498,21 +3498,6 @@
fun:_ZN12browser_sync19DataTypeManagerImpl10NotifyDoneENS_15DataTypeManager15ConfigureResultE
}
{
- bug_49268_0
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN19DownloadManagerTestC2Ev
- fun:_ZN45DownloadManagerTest_TestDownloadFilename_TestC1Ev
-}
-{
- bug_49268_1
- Memcheck:Leak
- fun:_Znw*
- ...
- fun:_ZN19DownloadManagerTestC2Ev
- fun:_ZN38DownloadManagerTest_StartDownload_TestC1Ev
-}
-{
bug_49279
Memcheck:Leak
fun:_Znw*