| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <memory> | 6 #include <memory> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/threading/thread_restrictions.h" |
| 13 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 17 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
| 17 #include "chrome/browser/browsing_data/cache_counter.h" | 18 #include "chrome/browser/browsing_data/cache_counter.h" |
| 18 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 19 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 21 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 71 |
| 71 void VerifyDownloadCount(size_t expected) { | 72 void VerifyDownloadCount(size_t expected) { |
| 72 content::DownloadManager* download_manager = | 73 content::DownloadManager* download_manager = |
| 73 content::BrowserContext::GetDownloadManager(browser()->profile()); | 74 content::BrowserContext::GetDownloadManager(browser()->profile()); |
| 74 std::vector<content::DownloadItem*> downloads; | 75 std::vector<content::DownloadItem*> downloads; |
| 75 download_manager->GetAllDownloads(&downloads); | 76 download_manager->GetAllDownloads(&downloads); |
| 76 EXPECT_EQ(expected, downloads.size()); | 77 EXPECT_EQ(expected, downloads.size()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void DownloadAnItem() { | 80 void DownloadAnItem() { |
| 81 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 80 base::ScopedTempDir downloads_directory; | 82 base::ScopedTempDir downloads_directory; |
| 81 ASSERT_TRUE(downloads_directory.CreateUniqueTempDir()); | 83 ASSERT_TRUE(downloads_directory.CreateUniqueTempDir()); |
| 82 browser()->profile()->GetPrefs()->SetFilePath( | 84 browser()->profile()->GetPrefs()->SetFilePath( |
| 83 prefs::kDownloadDefaultDirectory, downloads_directory.GetPath()); | 85 prefs::kDownloadDefaultDirectory, downloads_directory.GetPath()); |
| 84 | 86 |
| 85 // Start a download. | 87 // Start a download. |
| 86 content::DownloadManager* download_manager = | 88 content::DownloadManager* download_manager = |
| 87 content::BrowserContext::GetDownloadManager(browser()->profile()); | 89 content::BrowserContext::GetDownloadManager(browser()->profile()); |
| 88 std::unique_ptr<content::DownloadTestObserver> observer( | 90 std::unique_ptr<content::DownloadTestObserver> observer( |
| 89 new content::DownloadTestObserverTerminal( | 91 new content::DownloadTestObserverTerminal( |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 BrowserThread::PostTaskAndReply( | 318 BrowserThread::PostTaskAndReply( |
| 317 BrowserThread::IO, FROM_HERE, | 319 BrowserThread::IO, FROM_HERE, |
| 318 base::BindOnce( | 320 base::BindOnce( |
| 319 &BrowsingDataRemoverTransportSecurityStateBrowserTest:: | 321 &BrowsingDataRemoverTransportSecurityStateBrowserTest:: |
| 320 CheckTransportSecurityState, | 322 CheckTransportSecurityState, |
| 321 base::Unretained(this), | 323 base::Unretained(this), |
| 322 base::RetainedRef(browser()->profile()->GetRequestContext()), | 324 base::RetainedRef(browser()->profile()->GetRequestContext()), |
| 323 false /* should not be cleared */), | 325 false /* should not be cleared */), |
| 324 run_loop.QuitClosure()); | 326 run_loop.QuitClosure()); |
| 325 } | 327 } |
| OLD | NEW |