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 "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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 redirects.push_back(url); | 185 redirects.push_back(url); |
186 } | 186 } |
187 | 187 |
188 // Add all of this information to the history service. | 188 // Add all of this information to the history service. |
189 history_service->AddPage(url, base::Time::Now(), | 189 history_service->AddPage(url, base::Time::Now(), |
190 id_scope, page_id, | 190 id_scope, page_id, |
191 previous_url, redirects, | 191 previous_url, redirects, |
192 transition, history::SOURCE_BROWSED, true); | 192 transition, history::SOURCE_BROWSED, true); |
193 ThumbnailScore score(0.75, false, false); | 193 ThumbnailScore score(0.75, false, false); |
194 history_service->SetPageTitle(url, ConstructRandomTitle()); | 194 history_service->SetPageTitle(url, ConstructRandomTitle()); |
195 if (types & FULL_TEXT) | |
196 history_service->SetPageContents(url, ConstructRandomPage()); | |
197 if (types & TOP_SITES && top_sites) { | 195 if (types & TOP_SITES && top_sites) { |
198 top_sites->SetPageThumbnailToJPEGBytes( | 196 top_sites->SetPageThumbnailToJPEGBytes( |
199 url, | 197 url, |
200 (RandomInt(0, 2) == 0) ? google_bitmap.get() : weewar_bitmap.get(), | 198 (RandomInt(0, 2) == 0) ? google_bitmap.get() : weewar_bitmap.get(), |
201 score); | 199 score); |
202 } | 200 } |
203 | 201 |
204 previous_url = url; | 202 previous_url = url; |
205 | 203 |
206 if (revisit_urls.empty() || RandomFloat() < kRevisitableURLProbability) | 204 if (revisit_urls.empty() || RandomFloat() < kRevisitableURLProbability) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 path = file_iterator.Next(); | 262 path = file_iterator.Next(); |
265 } | 263 } |
266 | 264 |
267 printf("Finished creating profiles for testing.\n"); | 265 printf("Finished creating profiles for testing.\n"); |
268 | 266 |
269 // Restore the random seed. | 267 // Restore the random seed. |
270 srand(static_cast<unsigned int>(Time::Now().ToInternalValue())); | 268 srand(static_cast<unsigned int>(Time::Now().ToInternalValue())); |
271 | 269 |
272 return true; | 270 return true; |
273 } | 271 } |
OLD | NEW |