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

Side by Side Diff: chrome/browser/sync/test/integration/typed_urls_helper.cc

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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
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/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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 ui::PageTransition transition, 278 ui::PageTransition transition,
279 history::VisitSource source, 279 history::VisitSource source,
280 const base::Time& timestamp) { 280 const base::Time& timestamp) {
281 AddToHistory(HistoryServiceFactory::GetForProfileWithoutCreating( 281 AddToHistory(HistoryServiceFactory::GetForProfileWithoutCreating(
282 test()->GetProfile(index)), 282 test()->GetProfile(index)),
283 url, 283 url,
284 transition, 284 transition,
285 source, 285 source,
286 timestamp); 286 timestamp);
287 if (test()->use_verifier()) 287 if (test()->use_verifier())
288 AddToHistory( 288 AddToHistory(HistoryServiceFactory::GetForProfile(
289 HistoryServiceFactory::GetForProfile(test()->verifier(), 289 test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS),
290 Profile::IMPLICIT_ACCESS), 290 url, transition, source, timestamp);
291 url,
292 transition,
293 source,
294 timestamp);
295 291
296 // Wait until the AddPage() request has completed so we know the change has 292 // Wait until the AddPage() request has completed so we know the change has
297 // filtered down to the sync observers (don't need to wait for the 293 // filtered down to the sync observers (don't need to wait for the
298 // verifier profile since it doesn't sync). 294 // verifier profile since it doesn't sync).
299 WaitForHistoryDBThread(index); 295 WaitForHistoryDBThread(index);
300 } 296 }
301 297
302 void DeleteUrlFromHistory(int index, const GURL& url) { 298 void DeleteUrlFromHistory(int index, const GURL& url) {
303 HistoryServiceFactory::GetForProfileWithoutCreating( 299 HistoryServiceFactory::GetForProfileWithoutCreating(
304 test()->GetProfile(index))->DeleteURL(url); 300 test()->GetProfile(index))->DeleteURL(url);
305 if (test()->use_verifier()) 301 if (test()->use_verifier())
306 HistoryServiceFactory::GetForProfile(test()->verifier(), 302 HistoryServiceFactory::GetForProfile(
307 Profile::IMPLICIT_ACCESS)-> 303 test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS)->DeleteURL(url);
308 DeleteURL(url);
309 WaitForHistoryDBThread(index); 304 WaitForHistoryDBThread(index);
310 } 305 }
311 306
312 void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls) { 307 void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls) {
313 HistoryServiceFactory::GetForProfileWithoutCreating( 308 HistoryServiceFactory::GetForProfileWithoutCreating(
314 test()->GetProfile(index))->DeleteURLsForTest(urls); 309 test()->GetProfile(index))->DeleteURLsForTest(urls);
315 if (test()->use_verifier()) 310 if (test()->use_verifier())
316 HistoryServiceFactory::GetForProfile(test()->verifier(), 311 HistoryServiceFactory::GetForProfile(test()->verifier(),
317 Profile::IMPLICIT_ACCESS)-> 312 ServiceAccessType::IMPLICIT_ACCESS)
318 DeleteURLsForTest(urls); 313 ->DeleteURLsForTest(urls);
319 WaitForHistoryDBThread(index); 314 WaitForHistoryDBThread(index);
320 } 315 }
321 316
322 bool CheckURLRowVectorsAreEqual(const history::URLRows& left, 317 bool CheckURLRowVectorsAreEqual(const history::URLRows& left,
323 const history::URLRows& right) { 318 const history::URLRows& right) {
324 if (left.size() != right.size()) 319 if (left.size() != right.size())
325 return false; 320 return false;
326 for (size_t i = 0; i < left.size(); ++i) { 321 for (size_t i = 0; i < left.size(); ++i) {
327 // URLs could be out-of-order, so look for a matching URL in the second 322 // URLs could be out-of-order, so look for a matching URL in the second
328 // array. 323 // array.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 const history::URLRow& left, const history::URLRow& right) { 363 const history::URLRow& left, const history::URLRow& right) {
369 return (left.url() == right.url()) && 364 return (left.url() == right.url()) &&
370 (left.title() == right.title()) && 365 (left.title() == right.title()) &&
371 (left.visit_count() == right.visit_count()) && 366 (left.visit_count() == right.visit_count()) &&
372 (left.typed_count() == right.typed_count()) && 367 (left.typed_count() == right.typed_count()) &&
373 (left.last_visit() == right.last_visit()) && 368 (left.last_visit() == right.last_visit()) &&
374 (left.hidden() == right.hidden()); 369 (left.hidden() == right.hidden());
375 } 370 }
376 371
377 bool CheckAllProfilesHaveSameURLsAsVerifier() { 372 bool CheckAllProfilesHaveSameURLsAsVerifier() {
378 HistoryService* verifier_service = 373 HistoryService* verifier_service = HistoryServiceFactory::GetForProfile(
379 HistoryServiceFactory::GetForProfile(test()->verifier(), 374 test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS);
380 Profile::IMPLICIT_ACCESS);
381 history::URLRows verifier_urls = 375 history::URLRows verifier_urls =
382 GetTypedUrlsFromHistoryService(verifier_service); 376 GetTypedUrlsFromHistoryService(verifier_service);
383 for (int i = 0; i < test()->num_clients(); ++i) { 377 for (int i = 0; i < test()->num_clients(); ++i) {
384 history::URLRows urls = GetTypedUrlsFromClient(i); 378 history::URLRows urls = GetTypedUrlsFromClient(i);
385 if (!CheckURLRowVectorsAreEqual(verifier_urls, urls)) 379 if (!CheckURLRowVectorsAreEqual(verifier_urls, urls))
386 return false; 380 return false;
387 } 381 }
388 return true; 382 return true;
389 } 383 }
390 384
(...skipping 26 matching lines...) Expand all
417 411
418 } // namespace 412 } // namespace
419 413
420 bool AwaitCheckAllProfilesHaveSameURLsAsVerifier() { 414 bool AwaitCheckAllProfilesHaveSameURLsAsVerifier() {
421 ProfilesHaveSameURLsChecker checker; 415 ProfilesHaveSameURLsChecker checker;
422 checker.Wait(); 416 checker.Wait();
423 return !checker.TimedOut(); 417 return !checker.TimedOut();
424 } 418 }
425 419
426 } // namespace typed_urls_helper 420 } // namespace typed_urls_helper
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | chrome/browser/ui/android/navigation_popup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698