| OLD | NEW |
| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // Nonzero local count, empty sync. | 352 // Nonzero local count, empty sync. |
| 353 service->ClearSyncedVisits(); | 353 service->ClearSyncedVisits(); |
| 354 service->SetupFakeResponse(true /* success */, net::HTTP_OK); | 354 service->SetupFakeResponse(true /* success */, net::HTTP_OK); |
| 355 counter.Restart(); | 355 counter.Restart(); |
| 356 WaitForCounting(); | 356 WaitForCounting(); |
| 357 EXPECT_EQ(2u, GetLocalResult()); | 357 EXPECT_EQ(2u, GetLocalResult()); |
| 358 EXPECT_FALSE(HasSyncedVisits()); | 358 EXPECT_FALSE(HasSyncedVisits()); |
| 359 } | 359 } |
| 360 | 360 |
| 361 // Test that the counting restarts when history sync state changes. | 361 // Test that the counting restarts when history sync state changes. |
| 362 // TODO(crbug.com/553421): Enable this test and move it to the | 362 // TODO(crbug.com/553421): Move this to the sync/test/integration directory? |
| 363 // sync/test/integration directory. | |
| 364 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, RestartOnSyncChange) { | 363 IN_PROC_BROWSER_TEST_F(HistoryCounterTest, RestartOnSyncChange) { |
| 365 // Set up the Sync client. | 364 // Set up the Sync client. |
| 366 ASSERT_TRUE(SetupClients()); | 365 ASSERT_TRUE(SetupClients()); |
| 367 static const int kFirstProfileIndex = 0; | 366 static const int kFirstProfileIndex = 0; |
| 368 browser_sync::ProfileSyncService* sync_service = | 367 browser_sync::ProfileSyncService* sync_service = |
| 369 GetSyncService(kFirstProfileIndex); | 368 GetSyncService(kFirstProfileIndex); |
| 370 Profile* profile = GetProfile(kFirstProfileIndex); | 369 Profile* profile = GetProfile(kFirstProfileIndex); |
| 371 | 370 |
| 372 // Set up the fake web history service and the counter. | 371 // Set up the fake web history service and the counter. |
| 373 | 372 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // history deletion did not change. However, in reality we can get two | 434 // history deletion did not change. However, in reality we can get two |
| 436 // notifications, one that history sync has stopped and another that it is | 435 // notifications, one that history sync has stopped and another that it is |
| 437 // active again. | 436 // active again. |
| 438 | 437 |
| 439 // Stopping the Sync service triggers a restart. | 438 // Stopping the Sync service triggers a restart. |
| 440 sync_service->RequestStop(syncer::SyncService::CLEAR_DATA); | 439 sync_service->RequestStop(syncer::SyncService::CLEAR_DATA); |
| 441 WaitForCountingOrConfirmFinished(); | 440 WaitForCountingOrConfirmFinished(); |
| 442 } | 441 } |
| 443 | 442 |
| 444 } // namespace | 443 } // namespace |
| OLD | NEW |