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