| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| 11 #include "chrome/browser/sync/test/integration/single_client_status_change_check
er.h" | 11 #include "chrome/browser/sync/test/integration/single_client_status_change_check
er.h" |
| 12 #include "chrome/browser/sync/test/integration/sync_test.h" | 12 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 13 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" | 13 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" |
| 14 #include "components/bookmarks/browser/bookmark_model.h" | 14 #include "components/bookmarks/browser/bookmark_model.h" |
| 15 #include "components/browser_sync/profile_sync_service.h" | 15 #include "components/browser_sync/profile_sync_service.h" |
| 16 #include "components/sync/test/fake_server/bookmark_entity_builder.h" | 16 #include "components/sync/test/fake_server/bookmark_entity_builder.h" |
| 17 #include "components/sync/test/fake_server/entity_builder_factory.h" | 17 #include "components/sync/test/fake_server/entity_builder_factory.h" |
| 18 #include "components/sync/test/fake_server/fake_server_verifier.h" | 18 #include "components/sync/test/fake_server/fake_server_verifier.h" |
| 19 #include "components/sync/test/fake_server/tombstone_entity.h" |
| 19 #include "ui/base/layout.h" | 20 #include "ui/base/layout.h" |
| 20 | 21 |
| 21 using bookmarks::BookmarkModel; | 22 using bookmarks::BookmarkModel; |
| 22 using bookmarks::BookmarkNode; | 23 using bookmarks::BookmarkNode; |
| 23 using bookmarks_helper::AddFolder; | 24 using bookmarks_helper::AddFolder; |
| 24 using bookmarks_helper::AddURL; | 25 using bookmarks_helper::AddURL; |
| 25 using bookmarks_helper::CountBookmarksWithTitlesMatching; | 26 using bookmarks_helper::CountBookmarksWithTitlesMatching; |
| 26 using bookmarks_helper::CountBookmarksWithUrlsMatching; | 27 using bookmarks_helper::CountBookmarksWithUrlsMatching; |
| 27 using bookmarks_helper::CountFoldersWithTitlesMatching; | 28 using bookmarks_helper::CountFoldersWithTitlesMatching; |
| 28 using bookmarks_helper::Create1xFaviconFromPNGFile; | 29 using bookmarks_helper::Create1xFaviconFromPNGFile; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 340 |
| 340 DisableVerifier(); | 341 DisableVerifier(); |
| 341 ASSERT_TRUE(SetupSync()); | 342 ASSERT_TRUE(SetupSync()); |
| 342 | 343 |
| 343 ASSERT_EQ(1, CountBookmarksWithTitlesMatching(kSingleProfileIndex, title)); | 344 ASSERT_EQ(1, CountBookmarksWithTitlesMatching(kSingleProfileIndex, title)); |
| 344 | 345 |
| 345 std::vector<sync_pb::SyncEntity> server_bookmarks = | 346 std::vector<sync_pb::SyncEntity> server_bookmarks = |
| 346 GetFakeServer()->GetSyncEntitiesByModelType(syncer::BOOKMARKS); | 347 GetFakeServer()->GetSyncEntitiesByModelType(syncer::BOOKMARKS); |
| 347 ASSERT_EQ(1ul, server_bookmarks.size()); | 348 ASSERT_EQ(1ul, server_bookmarks.size()); |
| 348 std::string entity_id = server_bookmarks[0].id_string(); | 349 std::string entity_id = server_bookmarks[0].id_string(); |
| 349 std::unique_ptr<syncer::LoopbackServerEntity> tombstone( | 350 std::unique_ptr<fake_server::FakeServerEntity> tombstone( |
| 350 syncer::PersistentTombstoneEntity::CreateNew(entity_id, std::string())); | 351 fake_server::TombstoneEntity::Create(entity_id, std::string())); |
| 351 GetFakeServer()->InjectEntity(std::move(tombstone)); | 352 GetFakeServer()->InjectEntity(std::move(tombstone)); |
| 352 | 353 |
| 353 const syncer::ModelTypeSet kBookmarksType(syncer::BOOKMARKS); | 354 const syncer::ModelTypeSet kBookmarksType(syncer::BOOKMARKS); |
| 354 TriggerSyncForModelTypes(kSingleProfileIndex, kBookmarksType); | 355 TriggerSyncForModelTypes(kSingleProfileIndex, kBookmarksType); |
| 355 | 356 |
| 356 const int kExpectedCountAfterDeletion = 0; | 357 const int kExpectedCountAfterDeletion = 0; |
| 357 ASSERT_TRUE(BookmarksTitleChecker(kSingleProfileIndex, title, | 358 ASSERT_TRUE(BookmarksTitleChecker(kSingleProfileIndex, title, |
| 358 kExpectedCountAfterDeletion) | 359 kExpectedCountAfterDeletion) |
| 359 .Wait()); | 360 .Wait()); |
| 360 } | 361 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 ASSERT_EQ(0, CountFoldersWithTitlesMatching(kSingleProfileIndex, title)); | 411 ASSERT_EQ(0, CountFoldersWithTitlesMatching(kSingleProfileIndex, title)); |
| 411 | 412 |
| 412 ASSERT_TRUE(SetupSync()); | 413 ASSERT_TRUE(SetupSync()); |
| 413 | 414 |
| 414 ASSERT_EQ(1, CountFoldersWithTitlesMatching(kSingleProfileIndex, title)); | 415 ASSERT_EQ(1, CountFoldersWithTitlesMatching(kSingleProfileIndex, title)); |
| 415 } | 416 } |
| 416 | 417 |
| 417 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, E2E_ONLY(SanitySetup)) { | 418 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, E2E_ONLY(SanitySetup)) { |
| 418 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 419 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 419 } | 420 } |
| OLD | NEW |