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

Unified Diff: chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc

Issue 1137543002: Sync: add a test for downloading a tombstoned bookmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
diff --git a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
index f3428134968c1dbb7fd366951de0e14750a1fc70..2e0496337d46046d07a11791bfeb15e42a758f70 100644
--- a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
@@ -6,18 +6,21 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
+#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "sync/test/fake_server/bookmark_entity_builder.h"
#include "sync/test/fake_server/entity_builder_factory.h"
#include "sync/test/fake_server/fake_server_verifier.h"
+#include "sync/test/fake_server/tombstone_entity.h"
#include "ui/base/layout.h"
using bookmarks::BookmarkModel;
using bookmarks::BookmarkNode;
using bookmarks_helper::AddFolder;
using bookmarks_helper::AddURL;
+using bookmarks_helper::AwaitCountBookmarksWithTitlesMatching;
using bookmarks_helper::CountBookmarksWithTitlesMatching;
using bookmarks_helper::Create1xFaviconFromPNGFile;
using bookmarks_helper::GetBookmarkBarNode;
@@ -294,3 +297,33 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
// Verify model matches verifier.
ASSERT_TRUE(ModelMatchesVerifier(0));
}
+
+IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
+ DownloadDeletedBookmark) {
+ std::string title = "Patrick Star";
+ fake_server::EntityBuilderFactory entity_builder_factory;
+ scoped_ptr<fake_server::FakeServerEntity> entity =
+ entity_builder_factory.NewBookmarkEntityBuilder(
+ title, GURL("http://en.wikipedia.org/wiki/Patrick_Star")).Build();
+ fake_server_->InjectEntity(entity.Pass());
+
+ DisableVerifier();
+ ASSERT_TRUE(SetupSync());
+
+ ASSERT_EQ(1, CountBookmarksWithTitlesMatching(0, title));
+
+ std::vector<sync_pb::SyncEntity> server_bookmarks =
+ GetFakeServer()->GetSyncEntitiesByModelType(syncer::BOOKMARKS);
+ ASSERT_EQ(1ul, server_bookmarks.size());
+ std::string entity_id = server_bookmarks[0].id_string();
+ scoped_ptr<fake_server::FakeServerEntity> tombstone(
+ fake_server::TombstoneEntity::Create(entity_id));
+ GetFakeServer()->InjectEntity(tombstone.Pass());
+
+ const syncer::ModelTypeSet kBookmarksType(syncer::BOOKMARKS);
+ TriggerSyncForModelTypes(0, kBookmarksType);
+
+ ASSERT_TRUE(AwaitCountBookmarksWithTitlesMatching(0 /* profile */,
maniscalco 2015/05/08 20:13:18 nit: I like how you added a comment here to the re
pval...(no longer on Chromium) 2015/05/08 22:34:19 constant added in this file. PTAL. I think we cou
maniscalco 2015/05/08 23:56:14 Agreed.
+ title,
+ 0 /* expected_count */));
+}

Powered by Google App Engine
This is Rietveld 408576698