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

Side by Side Diff: chrome/test/perf/generate_profile.cc

Issue 19616004: Add asserts to TestingProfile::CreateHistoryService to ensure files are deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix release unit tests Created 7 years, 5 months 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
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/test/perf/generate_profile.h" 5 #include "chrome/test/perf/generate_profile.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // random number generator with the number of urls we're generating. 222 // random number generator with the number of urls we're generating.
223 srand(static_cast<unsigned int>(url_count)); 223 srand(static_cast<unsigned int>(url_count));
224 224
225 printf("Creating profiles for testing...\n"); 225 printf("Creating profiles for testing...\n");
226 226
227 InitBrowserProcess initialize_browser_process; 227 InitBrowserProcess initialize_browser_process;
228 base::MessageLoopForUI message_loop; 228 base::MessageLoopForUI message_loop;
229 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 229 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
230 content::TestBrowserThread db_thread(BrowserThread::DB, &message_loop); 230 content::TestBrowserThread db_thread(BrowserThread::DB, &message_loop);
231 TestingProfile profile; 231 TestingProfile profile;
232 profile.CreateHistoryService(false, false); 232 if (!profile.CreateHistoryService(false, false)) {
233 PLOG(ERROR) << "Creating history service failed";
234 return false;
235 }
233 if (types & TOP_SITES) { 236 if (types & TOP_SITES) {
234 profile.CreateTopSites(); 237 profile.CreateTopSites();
235 profile.BlockUntilTopSitesLoaded(); 238 profile.BlockUntilTopSitesLoaded();
236 } 239 }
237 240
238 // The maximum number of URLs to insert into history in one batch. 241 // The maximum number of URLs to insert into history in one batch.
239 const int kBatchSize = 2000; 242 const int kBatchSize = 2000;
240 int page_id = 0; 243 int page_id = 0;
241 while (page_id < url_count) { 244 while (page_id < url_count) {
242 const int batch_size = std::min(kBatchSize, url_count - page_id); 245 const int batch_size = std::min(kBatchSize, url_count - page_id);
(...skipping 21 matching lines...) Expand all
264 path = file_iterator.Next(); 267 path = file_iterator.Next();
265 } 268 }
266 269
267 printf("Finished creating profiles for testing.\n"); 270 printf("Finished creating profiles for testing.\n");
268 271
269 // Restore the random seed. 272 // Restore the random seed.
270 srand(static_cast<unsigned int>(Time::Now().ToInternalValue())); 273 srand(static_cast<unsigned int>(Time::Now().ToInternalValue()));
271 274
272 return true; 275 return true;
273 } 276 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698