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

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 8351052: Created a DownloadManager interface, for use in unit tests.. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 }; 160 };
161 161
162 // Get History Information. 162 // Get History Information.
163 class DownloadsHistoryDataCollector { 163 class DownloadsHistoryDataCollector {
164 public: 164 public:
165 DownloadsHistoryDataCollector(int64 download_db_handle, 165 DownloadsHistoryDataCollector(int64 download_db_handle,
166 DownloadManager* manager) 166 DownloadManager* manager)
167 : result_valid_(false), 167 : result_valid_(false),
168 download_db_handle_(download_db_handle) { 168 download_db_handle_(download_db_handle) {
169 HistoryService* hs = 169 HistoryService* hs =
170 Profile::FromBrowserContext(manager->browser_context())-> 170 Profile::FromBrowserContext(manager->BrowserContext())->
171 GetHistoryService(Profile::EXPLICIT_ACCESS); 171 GetHistoryService(Profile::EXPLICIT_ACCESS);
172 DCHECK(hs); 172 DCHECK(hs);
173 hs->QueryDownloads( 173 hs->QueryDownloads(
174 &callback_consumer_, 174 &callback_consumer_,
175 base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete, 175 base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete,
176 base::Unretained(this))); 176 base::Unretained(this)));
177 177
178 // TODO(rdsmith): Move message loop out of constructor. 178 // TODO(rdsmith): Move message loop out of constructor.
179 // Cannot complete immediately because the history backend runs on a 179 // Cannot complete immediately because the history backend runs on a
180 // separate thread, so we can assume that the RunMessageLoop below will 180 // separate thread, so we can assume that the RunMessageLoop below will
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 search_results.clear(); 1675 search_results.clear();
1676 1676
1677 manager->SearchDownloads(UTF8ToUTF16("another_file"), &search_results); 1677 manager->SearchDownloads(UTF8ToUTF16("another_file"), &search_results);
1678 ASSERT_EQ(2u, search_results.size()); 1678 ASSERT_EQ(2u, search_results.size());
1679 std::sort(search_results.begin(), search_results.end(), 1679 std::sort(search_results.begin(), search_results.end(),
1680 DownloadItemSorter); 1680 DownloadItemSorter);
1681 EXPECT_EQ(2, search_results[0]->db_handle()); 1681 EXPECT_EQ(2, search_results[0]->db_handle());
1682 EXPECT_EQ(3, search_results[1]->db_handle()); 1682 EXPECT_EQ(3, search_results[1]->db_handle());
1683 search_results.clear(); 1683 search_results.clear();
1684 } 1684 }
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698