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

Side by Side Diff: chrome/browser/browsing_data/history_counter_browsertest.cc

Issue 2828083003: Show autofill sync status in CBD (Closed)
Patch Set: fix history test Created 3 years, 7 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "components/browsing_data/core/counters/history_counter.h" 5 #include "components/browsing_data/core/counters/history_counter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "chrome/browser/history/history_service_factory.h" 10 #include "chrome/browser/history/history_service_factory.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 391
392 // We sync all datatypes by default, so starting Sync means that we start 392 // We sync all datatypes by default, so starting Sync means that we start
393 // syncing history deletion, and this should restart the counter. 393 // syncing history deletion, and this should restart the counter.
394 ASSERT_TRUE(SetupSync()); 394 ASSERT_TRUE(SetupSync());
395 ASSERT_TRUE(sync_service->IsSyncActive()); 395 ASSERT_TRUE(sync_service->IsSyncActive());
396 ASSERT_TRUE(sync_service->GetPreferredDataTypes().Has( 396 ASSERT_TRUE(sync_service->GetPreferredDataTypes().Has(
397 syncer::HISTORY_DELETE_DIRECTIVES)); 397 syncer::HISTORY_DELETE_DIRECTIVES));
398 WaitForCountingOrConfirmFinished(); 398 WaitForCountingOrConfirmFinished();
399 399
400 // We stop syncing history deletion in particular. This restarts the counter. 400 // We stop syncing history deletion in particular. This restarts the counter.
401 syncer::ModelTypeSet everything_except_history = syncer::ModelTypeSet::All(); 401 syncer::ModelTypeSet everything_except_history =
402 syncer::UserSelectableTypes();
402 everything_except_history.Remove(syncer::HISTORY_DELETE_DIRECTIVES); 403 everything_except_history.Remove(syncer::HISTORY_DELETE_DIRECTIVES);
403 auto sync_blocker = sync_service->GetSetupInProgressHandle(); 404 auto sync_blocker = sync_service->GetSetupInProgressHandle();
404 sync_service->ChangePreferredDataTypes(everything_except_history); 405 sync_service->OnUserChoseDatatypes(/*sync_everything=*/false,
406 everything_except_history);
405 sync_blocker.reset(); 407 sync_blocker.reset();
406 WaitForCountingOrConfirmFinished(); 408 WaitForCountingOrConfirmFinished();
407 409
408 // If the history deletion sync is not affected, the counter is not restarted. 410 // If the history deletion sync is not affected, the counter is not restarted.
409 syncer::ModelTypeSet only_passwords(syncer::PASSWORDS); 411 syncer::ModelTypeSet only_passwords(syncer::PASSWORDS);
410 sync_service->ChangePreferredDataTypes(only_passwords); 412 sync_service->ChangePreferredDataTypes(only_passwords);
411 sync_blocker = sync_service->GetSetupInProgressHandle(); 413 sync_blocker = sync_service->GetSetupInProgressHandle();
412 sync_service->ChangePreferredDataTypes(only_passwords); 414 sync_service->ChangePreferredDataTypes(only_passwords);
413 sync_blocker.reset(); 415 sync_blocker.reset();
414 EXPECT_FALSE(counter.HasTrackedTasks()); 416 EXPECT_FALSE(counter.HasTrackedTasks());
(...skipping 19 matching lines...) Expand all
434 // history deletion did not change. However, in reality we can get two 436 // history deletion did not change. However, in reality we can get two
435 // notifications, one that history sync has stopped and another that it is 437 // notifications, one that history sync has stopped and another that it is
436 // active again. 438 // active again.
437 439
438 // Stopping the Sync service triggers a restart. 440 // Stopping the Sync service triggers a restart.
439 sync_service->RequestStop(syncer::SyncService::CLEAR_DATA); 441 sync_service->RequestStop(syncer::SyncService::CLEAR_DATA);
440 WaitForCountingOrConfirmFinished(); 442 WaitForCountingOrConfirmFinished();
441 } 443 }
442 444
443 } // namespace 445 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698