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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 // Get History Information. | 245 // Get History Information. |
246 class DownloadsHistoryDataCollector { | 246 class DownloadsHistoryDataCollector { |
247 public: | 247 public: |
248 explicit DownloadsHistoryDataCollector(Profile* profile) | 248 explicit DownloadsHistoryDataCollector(Profile* profile) |
249 : profile_(profile), result_valid_(false) {} | 249 : profile_(profile), result_valid_(false) {} |
250 | 250 |
251 bool WaitForDownloadInfo( | 251 bool WaitForDownloadInfo( |
252 scoped_ptr<std::vector<history::DownloadRow> >* results) { | 252 scoped_ptr<std::vector<history::DownloadRow> >* results) { |
253 HistoryService* hs = HistoryServiceFactory::GetForProfile( | 253 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
254 profile_, Profile::EXPLICIT_ACCESS); | 254 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
255 DCHECK(hs); | 255 DCHECK(hs); |
256 hs->QueryDownloads( | 256 hs->QueryDownloads( |
257 base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete, | 257 base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete, |
258 base::Unretained(this))); | 258 base::Unretained(this))); |
259 | 259 |
260 content::RunMessageLoop(); | 260 content::RunMessageLoop(); |
261 if (result_valid_) { | 261 if (result_valid_) { |
262 *results = results_.Pass(); | 262 *results = results_.Pass(); |
263 } | 263 } |
264 return result_valid_; | 264 return result_valid_; |
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 // there are CRLF transformations for those files. | 1887 // there are CRLF transformations for those files. |
1888 } | 1888 } |
1889 | 1889 |
1890 IN_PROC_BROWSER_TEST_F(DownloadTest, PRE_DownloadTest_History) { | 1890 IN_PROC_BROWSER_TEST_F(DownloadTest, PRE_DownloadTest_History) { |
1891 // Download a file and wait for it to be stored. | 1891 // Download a file and wait for it to be stored. |
1892 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1892 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
1893 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1893 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); |
1894 HistoryObserver observer(browser()->profile()); | 1894 HistoryObserver observer(browser()->profile()); |
1895 DownloadAndWait(browser(), download_url); | 1895 DownloadAndWait(browser(), download_url); |
1896 observer.WaitForStored(); | 1896 observer.WaitForStored(); |
1897 HistoryServiceFactory::GetForProfile( | 1897 HistoryServiceFactory::GetForProfile(browser()->profile(), |
1898 browser()->profile(), Profile::IMPLICIT_ACCESS)->FlushForTest( | 1898 ServiceAccessType::IMPLICIT_ACCESS) |
1899 base::Bind(&base::MessageLoop::Quit, | 1899 ->FlushForTest(base::Bind( |
1900 base::Unretained(base::MessageLoop::current()->current()))); | 1900 &base::MessageLoop::Quit, |
| 1901 base::Unretained(base::MessageLoop::current()->current()))); |
1901 content::RunMessageLoop(); | 1902 content::RunMessageLoop(); |
1902 } | 1903 } |
1903 | 1904 |
1904 #if defined(OS_CHROMEOS) | 1905 #if defined(OS_CHROMEOS) |
1905 // Times out on ChromeOS: http://crbug.com/217810 | 1906 // Times out on ChromeOS: http://crbug.com/217810 |
1906 #define MAYBE_DownloadTest_History DISABLED_DownloadTest_History | 1907 #define MAYBE_DownloadTest_History DISABLED_DownloadTest_History |
1907 #else | 1908 #else |
1908 #define MAYBE_DownloadTest_History DownloadTest_History | 1909 #define MAYBE_DownloadTest_History DownloadTest_History |
1909 #endif | 1910 #endif |
1910 IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_History) { | 1911 IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_History) { |
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3519 *(downloads[0]))); | 3520 *(downloads[0]))); |
3520 | 3521 |
3521 // Begin feedback and check that the file is "stolen". | 3522 // Begin feedback and check that the file is "stolen". |
3522 download_protection_service->feedback_service()->BeginFeedbackForDownload( | 3523 download_protection_service->feedback_service()->BeginFeedbackForDownload( |
3523 downloads[0]); | 3524 downloads[0]); |
3524 std::vector<DownloadItem*> updated_downloads; | 3525 std::vector<DownloadItem*> updated_downloads; |
3525 GetDownloads(browser(), &updated_downloads); | 3526 GetDownloads(browser(), &updated_downloads); |
3526 ASSERT_TRUE(updated_downloads.empty()); | 3527 ASSERT_TRUE(updated_downloads.empty()); |
3527 } | 3528 } |
3528 #endif | 3529 #endif |
OLD | NEW |