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/browser/sync/test/integration/typed_urls_helper.h" | 5 #include "chrome/browser/sync/test/integration/typed_urls_helper.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/task/cancelable_task_tracker.h" | 10 #include "base/task/cancelable_task_tracker.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return GetUrlFromHistoryService(service, url, row); | 244 return GetUrlFromHistoryService(service, url, row); |
245 } | 245 } |
246 | 246 |
247 history::VisitVector GetVisitsFromClient(int index, history::URLID id) { | 247 history::VisitVector GetVisitsFromClient(int index, history::URLID id) { |
248 history::HistoryService* service = | 248 history::HistoryService* service = |
249 HistoryServiceFactory::GetForProfileWithoutCreating( | 249 HistoryServiceFactory::GetForProfileWithoutCreating( |
250 test()->GetProfile(index)); | 250 test()->GetProfile(index)); |
251 return GetVisitsFromHistoryService(service, id); | 251 return GetVisitsFromHistoryService(service, id); |
252 } | 252 } |
253 | 253 |
| 254 history::VisitVector GetVisitsForURLFromClient(int index, const GURL& url) { |
| 255 history::HistoryService* service = |
| 256 HistoryServiceFactory::GetForProfileWithoutCreating( |
| 257 test()->GetProfile(index)); |
| 258 history::URLRow url_row; |
| 259 if (!GetUrlFromHistoryService(service, url, &url_row)) |
| 260 return history::VisitVector(); |
| 261 return GetVisitsFromHistoryService(service, url_row.id()); |
| 262 } |
| 263 |
254 void RemoveVisitsFromClient(int index, const history::VisitVector& visits) { | 264 void RemoveVisitsFromClient(int index, const history::VisitVector& visits) { |
255 history::HistoryService* service = | 265 history::HistoryService* service = |
256 HistoryServiceFactory::GetForProfileWithoutCreating( | 266 HistoryServiceFactory::GetForProfileWithoutCreating( |
257 test()->GetProfile(index)); | 267 test()->GetProfile(index)); |
258 RemoveVisitsFromHistoryService(service, visits); | 268 RemoveVisitsFromHistoryService(service, visits); |
259 } | 269 } |
260 | 270 |
261 base::Time GetTimestamp() { | 271 base::Time GetTimestamp() { |
262 // The history subsystem doesn't like identical timestamps for page visits, | 272 // The history subsystem doesn't like identical timestamps for page visits, |
263 // and it will massage the visit timestamps if we try to use identical | 273 // and it will massage the visit timestamps if we try to use identical |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 430 |
421 } // namespace | 431 } // namespace |
422 | 432 |
423 bool AwaitCheckAllProfilesHaveSameURLsAsVerifier() { | 433 bool AwaitCheckAllProfilesHaveSameURLsAsVerifier() { |
424 ProfilesHaveSameURLsChecker checker; | 434 ProfilesHaveSameURLsChecker checker; |
425 checker.Wait(); | 435 checker.Wait(); |
426 return !checker.TimedOut(); | 436 return !checker.TimedOut(); |
427 } | 437 } |
428 | 438 |
429 } // namespace typed_urls_helper | 439 } // namespace typed_urls_helper |
OLD | NEW |