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

Side by Side Diff: chrome/browser/history/history_unittest.cc

Issue 5603008: Modify the "dangerous download" algorithm as follows. Original patch by Pier... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // History unit tests come in two flavors: 5 // History unit tests come in two flavors:
6 // 6 //
7 // 1. The more complicated style is that the unit test creates a full history 7 // 1. The more complicated style is that the unit test creates a full history
8 // service. This spawns a background thread for the history backend, and 8 // service. This spawns a background thread for the history backend, and
9 // all communication is asynchronous. This is useful for testing more 9 // all communication is asynchronous. This is useful for testing more
10 // complicated things or end-to-end behavior. 10 // complicated things or end-to-end behavior.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 // Wait for the backend class to terminate before deleting the files and 193 // Wait for the backend class to terminate before deleting the files and
194 // moving to the next test. Note: if this never terminates, somebody is 194 // moving to the next test. Note: if this never terminates, somebody is
195 // probably leaking a reference to the history backend, so it never calls 195 // probably leaking a reference to the history backend, so it never calls
196 // our destroy task. 196 // our destroy task.
197 MessageLoop::current()->Run(); 197 MessageLoop::current()->Run();
198 } 198 }
199 199
200 int64 AddDownload(int32 state, const Time& time) { 200 int64 AddDownload(int32 state, const Time& time) {
201 DownloadCreateInfo download(FilePath(FILE_PATH_LITERAL("foo-path")), 201 DownloadCreateInfo download(FilePath(FILE_PATH_LITERAL("foo-path")),
202 GURL("foo-url"), time, 0, 512, state, 0); 202 GURL("foo-url"), time, 0, 512, state, 0, false);
203 return db_->CreateDownload(download); 203 return db_->CreateDownload(download);
204 } 204 }
205 205
206 // Fills the query_url_row_ and query_url_visits_ structures with the 206 // Fills the query_url_row_ and query_url_visits_ structures with the
207 // information about the given URL and returns true. If the URL was not 207 // information about the given URL and returns true. If the URL was not
208 // found, this will return false and those structures will not be changed. 208 // found, this will return false and those structures will not be changed.
209 bool QueryURL(HistoryService* history, const GURL& url) { 209 bool QueryURL(HistoryService* history, const GURL& url) {
210 history->QueryURL(url, true, &consumer_, 210 history->QueryURL(url, true, &consumer_,
211 NewCallback(this, &HistoryTest::SaveURLAndQuit)); 211 NewCallback(this, &HistoryTest::SaveURLAndQuit));
212 MessageLoop::current()->Run(); // Will be exited in SaveURLAndQuit. 212 MessageLoop::current()->Run(); // Will be exited in SaveURLAndQuit.
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 history_service_ = history; 932 history_service_ = history;
933 history->ScheduleDBTask(task.get(), &request_consumer); 933 history->ScheduleDBTask(task.get(), &request_consumer);
934 request_consumer.CancelAllRequests(); 934 request_consumer.CancelAllRequests();
935 CleanupHistoryService(); 935 CleanupHistoryService();
936 // WARNING: history has now been deleted. 936 // WARNING: history has now been deleted.
937 history = NULL; 937 history = NULL;
938 ASSERT_FALSE(task->done_invoked); 938 ASSERT_FALSE(task->done_invoked);
939 } 939 }
940 940
941 } // namespace history 941 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/download_create_info.cc ('k') | chrome/browser/renderer_host/download_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698