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

Side by Side Diff: chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Rebase Created 4 years, 2 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) 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_integration_test_util.h"
13 #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 "
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 "components/sync/test/fake_server/tombstone_entity.h"
20 #include "ui/base/layout.h" 20 #include "ui/base/layout.h"
21 21
22 using bookmarks::BookmarkModel; 22 using bookmarks::BookmarkModel;
23 using bookmarks::BookmarkNode; 23 using bookmarks::BookmarkNode;
24 using bookmarks_helper::AddFolder; 24 using bookmarks_helper::AddFolder;
25 using bookmarks_helper::AddURL; 25 using bookmarks_helper::AddURL;
26 using bookmarks_helper::AwaitCountBookmarksWithTitlesMatching;
27 using bookmarks_helper::AwaitCountBookmarksWithUrlsMatching;
28 using bookmarks_helper::CountBookmarksWithTitlesMatching; 26 using bookmarks_helper::CountBookmarksWithTitlesMatching;
29 using bookmarks_helper::CountBookmarksWithUrlsMatching; 27 using bookmarks_helper::CountBookmarksWithUrlsMatching;
30 using bookmarks_helper::CountFoldersWithTitlesMatching; 28 using bookmarks_helper::CountFoldersWithTitlesMatching;
31 using bookmarks_helper::Create1xFaviconFromPNGFile; 29 using bookmarks_helper::Create1xFaviconFromPNGFile;
32 using bookmarks_helper::GetBookmarkBarNode; 30 using bookmarks_helper::GetBookmarkBarNode;
33 using bookmarks_helper::GetBookmarkModel; 31 using bookmarks_helper::GetBookmarkModel;
34 using bookmarks_helper::GetOtherNode; 32 using bookmarks_helper::GetOtherNode;
35 using bookmarks_helper::ModelMatchesVerifier; 33 using bookmarks_helper::ModelMatchesVerifier;
36 using bookmarks_helper::Move; 34 using bookmarks_helper::Move;
37 using bookmarks_helper::Remove; 35 using bookmarks_helper::Remove;
38 using bookmarks_helper::RemoveAll; 36 using bookmarks_helper::RemoveAll;
39 using bookmarks_helper::SetFavicon; 37 using bookmarks_helper::SetFavicon;
40 using bookmarks_helper::SetTitle; 38 using bookmarks_helper::SetTitle;
41 using sync_integration_test_util::AwaitCommitActivityCompletion;
42 39
43 // All tests in this file utilize a single profile. 40 // All tests in this file utilize a single profile.
44 // TODO(pvalenzuela): Standardize this pattern by moving this constant to 41 // TODO(pvalenzuela): Standardize this pattern by moving this constant to
45 // SyncTest and using it in all single client tests. 42 // SyncTest and using it in all single client tests.
46 const int kSingleProfileIndex = 0; 43 const int kSingleProfileIndex = 0;
47 44
48 class SingleClientBookmarksSyncTest : public SyncTest { 45 class SingleClientBookmarksSyncTest : public SyncTest {
49 public: 46 public:
50 SingleClientBookmarksSyncTest() : SyncTest(SINGLE_CLIENT) {} 47 SingleClientBookmarksSyncTest() : SyncTest(SINGLE_CLIENT) {}
51 ~SingleClientBookmarksSyncTest() override {} 48 ~SingleClientBookmarksSyncTest() override {}
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const BookmarkNode* tier1_a_url2 = AddURL( 100 const BookmarkNode* tier1_a_url2 = AddURL(
104 kSingleProfileIndex, tier1_a, 2, "tier1_a_url2", 101 kSingleProfileIndex, tier1_a, 2, "tier1_a_url2",
105 GURL("http://www.facebook.com")); 102 GURL("http://www.facebook.com"));
106 const BookmarkNode* tier1_b_url0 = AddURL( 103 const BookmarkNode* tier1_b_url0 = AddURL(
107 kSingleProfileIndex, tier1_b, 0, "tier1_b_url0", 104 kSingleProfileIndex, tier1_b, 0, "tier1_b_url0",
108 GURL("http://www.nhl.com")); 105 GURL("http://www.nhl.com"));
109 106
110 // Setup sync, wait for its completion, and make sure changes were synced. 107 // Setup sync, wait for its completion, and make sure changes were synced.
111 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 108 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
112 ASSERT_TRUE( 109 ASSERT_TRUE(
113 AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex))); 110 UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
114 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); 111 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
115 112
116 // Ultimately we want to end up with the following model; but this test is 113 // Ultimately we want to end up with the following model; but this test is
117 // more about the journey than the destination. 114 // more about the journey than the destination.
118 // 115 //
119 // bookmark_bar 116 // bookmark_bar
120 // -> CNN (www.cnn.com) 117 // -> CNN (www.cnn.com)
121 // -> tier1_a 118 // -> tier1_a
122 // -> tier1_a_url2 (www.facebook.com) 119 // -> tier1_a_url2 (www.facebook.com)
123 // -> tier1_a_url1 (www.pandora.com) 120 // -> tier1_a_url1 (www.pandora.com)
(...skipping 11 matching lines...) Expand all
135 // -> Wynn (www.wynnlasvegas.com) 132 // -> Wynn (www.wynnlasvegas.com)
136 // -> tier1_a_url0 133 // -> tier1_a_url0
137 const BookmarkNode* bar = GetBookmarkBarNode(kSingleProfileIndex); 134 const BookmarkNode* bar = GetBookmarkBarNode(kSingleProfileIndex);
138 const BookmarkNode* cnn = AddURL( 135 const BookmarkNode* cnn = AddURL(
139 kSingleProfileIndex, bar, 0, "CNN", GURL("http://www.cnn.com")); 136 kSingleProfileIndex, bar, 0, "CNN", GURL("http://www.cnn.com"));
140 ASSERT_TRUE(cnn != NULL); 137 ASSERT_TRUE(cnn != NULL);
141 Move(kSingleProfileIndex, tier1_a, bar, 1); 138 Move(kSingleProfileIndex, tier1_a, bar, 1);
142 139
143 // Wait for the bookmark position change to sync. 140 // Wait for the bookmark position change to sync.
144 ASSERT_TRUE( 141 ASSERT_TRUE(
145 AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex))); 142 UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
146 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); 143 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
147 144
148 const BookmarkNode* porsche = AddURL( 145 const BookmarkNode* porsche = AddURL(
149 kSingleProfileIndex, bar, 2, "Porsche", GURL("http://www.porsche.com")); 146 kSingleProfileIndex, bar, 2, "Porsche", GURL("http://www.porsche.com"));
150 // Rearrange stuff in tier1_a. 147 // Rearrange stuff in tier1_a.
151 ASSERT_EQ(tier1_a, tier1_a_url2->parent()); 148 ASSERT_EQ(tier1_a, tier1_a_url2->parent());
152 ASSERT_EQ(tier1_a, tier1_a_url1->parent()); 149 ASSERT_EQ(tier1_a, tier1_a_url1->parent());
153 Move(kSingleProfileIndex, tier1_a_url2, tier1_a, 0); 150 Move(kSingleProfileIndex, tier1_a_url2, tier1_a, 0);
154 Move(kSingleProfileIndex, tier1_a_url1, tier1_a, 2); 151 Move(kSingleProfileIndex, tier1_a_url1, tier1_a, 2);
155 152
156 // Wait for the rearranged hierarchy to sync. 153 // Wait for the rearranged hierarchy to sync.
157 ASSERT_TRUE( 154 ASSERT_TRUE(
158 AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex))); 155 UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
159 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); 156 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
160 157
161 ASSERT_EQ(1, tier1_a_url0->parent()->GetIndexOf(tier1_a_url0)); 158 ASSERT_EQ(1, tier1_a_url0->parent()->GetIndexOf(tier1_a_url0));
162 Move(kSingleProfileIndex, tier1_a_url0, bar, bar->child_count()); 159 Move(kSingleProfileIndex, tier1_a_url0, bar, bar->child_count());
163 const BookmarkNode* boa = AddURL( 160 const BookmarkNode* boa = AddURL(
164 kSingleProfileIndex, bar, bar->child_count(), 161 kSingleProfileIndex, bar, bar->child_count(),
165 "Bank of America", GURL("https://www.bankofamerica.com")); 162 "Bank of America", GURL("https://www.bankofamerica.com"));
166 ASSERT_TRUE(boa != NULL); 163 ASSERT_TRUE(boa != NULL);
167 Move(kSingleProfileIndex, tier1_a_url0, top, top->child_count()); 164 Move(kSingleProfileIndex, tier1_a_url0, top, top->child_count());
168 const BookmarkNode* bubble = AddURL( 165 const BookmarkNode* bubble = AddURL(
169 kSingleProfileIndex, bar, bar->child_count(), "Seattle Bubble", 166 kSingleProfileIndex, bar, bar->child_count(), "Seattle Bubble",
170 GURL("http://seattlebubble.com")); 167 GURL("http://seattlebubble.com"));
171 ASSERT_TRUE(bubble != NULL); 168 ASSERT_TRUE(bubble != NULL);
172 const BookmarkNode* wired = AddURL( 169 const BookmarkNode* wired = AddURL(
173 kSingleProfileIndex, bar, 2, "Wired News", GURL("http://www.wired.com")); 170 kSingleProfileIndex, bar, 2, "Wired News", GURL("http://www.wired.com"));
174 const BookmarkNode* tier2_b = AddFolder( 171 const BookmarkNode* tier2_b = AddFolder(
175 kSingleProfileIndex, tier1_b, 0, "tier2_b"); 172 kSingleProfileIndex, tier1_b, 0, "tier2_b");
176 Move(kSingleProfileIndex, tier1_b_url0, tier2_b, 0); 173 Move(kSingleProfileIndex, tier1_b_url0, tier2_b, 0);
177 Move(kSingleProfileIndex, porsche, bar, 0); 174 Move(kSingleProfileIndex, porsche, bar, 0);
178 SetTitle(kSingleProfileIndex, wired, "News Wired"); 175 SetTitle(kSingleProfileIndex, wired, "News Wired");
179 SetTitle(kSingleProfileIndex, porsche, "ICanHazPorsche?"); 176 SetTitle(kSingleProfileIndex, porsche, "ICanHazPorsche?");
180 177
181 // Wait for the title change to sync. 178 // Wait for the title change to sync.
182 ASSERT_TRUE( 179 ASSERT_TRUE(
183 AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex))); 180 UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
184 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); 181 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
185 182
186 ASSERT_EQ(tier1_a_url0->id(), top->GetChild(top->child_count() - 1)->id()); 183 ASSERT_EQ(tier1_a_url0->id(), top->GetChild(top->child_count() - 1)->id());
187 Remove(kSingleProfileIndex, top, top->child_count() - 1); 184 Remove(kSingleProfileIndex, top, top->child_count() - 1);
188 Move(kSingleProfileIndex, wired, tier1_b, 0); 185 Move(kSingleProfileIndex, wired, tier1_b, 0);
189 Move(kSingleProfileIndex, porsche, bar, 3); 186 Move(kSingleProfileIndex, porsche, bar, 3);
190 const BookmarkNode* tier3_b = AddFolder( 187 const BookmarkNode* tier3_b = AddFolder(
191 kSingleProfileIndex, tier2_b, 1, "tier3_b"); 188 kSingleProfileIndex, tier2_b, 1, "tier3_b");
192 const BookmarkNode* leafs = AddURL( 189 const BookmarkNode* leafs = AddURL(
193 kSingleProfileIndex, tier1_a, 0, "Toronto Maple Leafs", 190 kSingleProfileIndex, tier1_a, 0, "Toronto Maple Leafs",
194 GURL("http://mapleleafs.nhl.com")); 191 GURL("http://mapleleafs.nhl.com"));
195 const BookmarkNode* wynn = AddURL( 192 const BookmarkNode* wynn = AddURL(
196 kSingleProfileIndex, bar, 1, "Wynn", GURL("http://www.wynnlasvegas.com")); 193 kSingleProfileIndex, bar, 1, "Wynn", GURL("http://www.wynnlasvegas.com"));
197 194
198 Move(kSingleProfileIndex, wynn, tier3_b, 0); 195 Move(kSingleProfileIndex, wynn, tier3_b, 0);
199 Move(kSingleProfileIndex, leafs, tier3_b, 0); 196 Move(kSingleProfileIndex, leafs, tier3_b, 0);
200 197
201 // Wait for newly added bookmarks to sync. 198 // Wait for newly added bookmarks to sync.
202 ASSERT_TRUE( 199 ASSERT_TRUE(
203 AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex))); 200 UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
204 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); 201 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
205 202
206 // Only verify FakeServer data if FakeServer is being used. 203 // Only verify FakeServer data if FakeServer is being used.
207 // TODO(pvalenzuela): Use this style of verification in more tests once it is 204 // TODO(pvalenzuela): Use this style of verification in more tests once it is
208 // proven stable. 205 // proven stable.
209 if (GetFakeServer()) 206 if (GetFakeServer())
210 VerifyBookmarkModelMatchesFakeServer(kSingleProfileIndex); 207 VerifyBookmarkModelMatchesFakeServer(kSingleProfileIndex);
211 } 208 }
212 209
213 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, InjectedBookmark) { 210 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, InjectedBookmark) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // than the one native to the OS. This tests the PNG data is not decoded to 246 // than the one native to the OS. This tests the PNG data is not decoded to
250 // SkBitmap (or any other image format) then encoded back to PNG on the path 247 // SkBitmap (or any other image format) then encoded back to PNG on the path
251 // between sync and the database. 248 // between sync and the database.
252 gfx::Image original_favicon = Create1xFaviconFromPNGFile( 249 gfx::Image original_favicon = Create1xFaviconFromPNGFile(
253 "favicon_cocoa_png_codec.png"); 250 "favicon_cocoa_png_codec.png");
254 ASSERT_FALSE(original_favicon.IsEmpty()); 251 ASSERT_FALSE(original_favicon.IsEmpty());
255 SetFavicon(kSingleProfileIndex, bookmark, icon_url, original_favicon, 252 SetFavicon(kSingleProfileIndex, bookmark, icon_url, original_favicon,
256 bookmarks_helper::FROM_SYNC); 253 bookmarks_helper::FROM_SYNC);
257 254
258 ASSERT_TRUE( 255 ASSERT_TRUE(
259 AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex))); 256 UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
260 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); 257 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
261 258
262 scoped_refptr<base::RefCountedMemory> original_favicon_bytes = 259 scoped_refptr<base::RefCountedMemory> original_favicon_bytes =
263 original_favicon.As1xPNGBytes(); 260 original_favicon.As1xPNGBytes();
264 gfx::Image final_favicon = 261 gfx::Image final_favicon =
265 GetBookmarkModel(kSingleProfileIndex)->GetFavicon(bookmark); 262 GetBookmarkModel(kSingleProfileIndex)->GetFavicon(bookmark);
266 scoped_refptr<base::RefCountedMemory> final_favicon_bytes = 263 scoped_refptr<base::RefCountedMemory> final_favicon_bytes =
267 final_favicon.As1xPNGBytes(); 264 final_favicon.As1xPNGBytes();
268 265
269 // Check that the data was not mutated from the original. 266 // Check that the data was not mutated from the original.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 AddFolder(kSingleProfileIndex, GetBookmarkBarNode(kSingleProfileIndex), 1, 308 AddFolder(kSingleProfileIndex, GetBookmarkBarNode(kSingleProfileIndex), 1,
312 "folder1"); 309 "folder1");
313 ASSERT_TRUE(AddURL(kSingleProfileIndex, folder1, 0, "Yahoo", 310 ASSERT_TRUE(AddURL(kSingleProfileIndex, folder1, 0, "Yahoo",
314 GURL("http://www.yahoo.com"))); 311 GURL("http://www.yahoo.com")));
315 ASSERT_TRUE(AddURL(kSingleProfileIndex, GetBookmarkBarNode(0), 2, "Gmai", 312 ASSERT_TRUE(AddURL(kSingleProfileIndex, GetBookmarkBarNode(0), 2, "Gmai",
316 GURL("http://gmail.com"))); 313 GURL("http://gmail.com")));
317 314
318 // Set up sync, wait for its completion and verify that changes propagated. 315 // Set up sync, wait for its completion and verify that changes propagated.
319 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 316 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
320 ASSERT_TRUE( 317 ASSERT_TRUE(
321 AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex))); 318 UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
322 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); 319 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
323 320
324 // Remove all bookmarks and wait for sync completion. 321 // Remove all bookmarks and wait for sync completion.
325 RemoveAll(kSingleProfileIndex); 322 RemoveAll(kSingleProfileIndex);
326 ASSERT_TRUE( 323 ASSERT_TRUE(
327 AwaitCommitActivityCompletion(GetSyncService(kSingleProfileIndex))); 324 UpdatedProgressMarkerChecker(GetSyncService(kSingleProfileIndex)).Wait());
328 // Verify other node has no children now. 325 // Verify other node has no children now.
329 EXPECT_EQ(0, GetOtherNode(kSingleProfileIndex)->child_count()); 326 EXPECT_EQ(0, GetOtherNode(kSingleProfileIndex)->child_count());
330 EXPECT_EQ(0, GetBookmarkBarNode(kSingleProfileIndex)->child_count()); 327 EXPECT_EQ(0, GetBookmarkBarNode(kSingleProfileIndex)->child_count());
331 // Verify model matches verifier. 328 // Verify model matches verifier.
332 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex)); 329 ASSERT_TRUE(ModelMatchesVerifier(kSingleProfileIndex));
333 } 330 }
334 331
335 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, 332 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
336 DownloadDeletedBookmark) { 333 DownloadDeletedBookmark) {
337 std::string title = "Patrick Star"; 334 std::string title = "Patrick Star";
(...skipping 13 matching lines...) Expand all
351 ASSERT_EQ(1ul, server_bookmarks.size()); 348 ASSERT_EQ(1ul, server_bookmarks.size());
352 std::string entity_id = server_bookmarks[0].id_string(); 349 std::string entity_id = server_bookmarks[0].id_string();
353 std::unique_ptr<fake_server::FakeServerEntity> tombstone( 350 std::unique_ptr<fake_server::FakeServerEntity> tombstone(
354 fake_server::TombstoneEntity::Create(entity_id, std::string())); 351 fake_server::TombstoneEntity::Create(entity_id, std::string()));
355 GetFakeServer()->InjectEntity(std::move(tombstone)); 352 GetFakeServer()->InjectEntity(std::move(tombstone));
356 353
357 const syncer::ModelTypeSet kBookmarksType(syncer::BOOKMARKS); 354 const syncer::ModelTypeSet kBookmarksType(syncer::BOOKMARKS);
358 TriggerSyncForModelTypes(kSingleProfileIndex, kBookmarksType); 355 TriggerSyncForModelTypes(kSingleProfileIndex, kBookmarksType);
359 356
360 const int kExpectedCountAfterDeletion = 0; 357 const int kExpectedCountAfterDeletion = 0;
361 ASSERT_TRUE(AwaitCountBookmarksWithTitlesMatching( 358 ASSERT_TRUE(BookmarksTitleChecker(kSingleProfileIndex, title,
362 kSingleProfileIndex, title, kExpectedCountAfterDeletion)); 359 kExpectedCountAfterDeletion)
360 .Wait());
363 } 361 }
364 362
365 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, 363 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest,
366 DownloadModifiedBookmark) { 364 DownloadModifiedBookmark) {
367 std::string title = "Syrup"; 365 std::string title = "Syrup";
368 GURL original_url = GURL("https://en.wikipedia.org/?title=Maple_syrup"); 366 GURL original_url = GURL("https://en.wikipedia.org/?title=Maple_syrup");
369 GURL updated_url = GURL("https://en.wikipedia.org/wiki/Xylem"); 367 GURL updated_url = GURL("https://en.wikipedia.org/wiki/Xylem");
370 368
371 fake_server::EntityBuilderFactory entity_builder_factory; 369 fake_server::EntityBuilderFactory entity_builder_factory;
372 fake_server::BookmarkEntityBuilder bookmark_builder = 370 fake_server::BookmarkEntityBuilder bookmark_builder =
(...skipping 15 matching lines...) Expand all
388 std::string entity_id = server_bookmarks[0].id_string(); 386 std::string entity_id = server_bookmarks[0].id_string();
389 387
390 sync_pb::EntitySpecifics specifics = server_bookmarks[0].specifics(); 388 sync_pb::EntitySpecifics specifics = server_bookmarks[0].specifics();
391 sync_pb::BookmarkSpecifics* bookmark_specifics = specifics.mutable_bookmark(); 389 sync_pb::BookmarkSpecifics* bookmark_specifics = specifics.mutable_bookmark();
392 bookmark_specifics->set_url(updated_url.spec()); 390 bookmark_specifics->set_url(updated_url.spec());
393 ASSERT_TRUE(GetFakeServer()->ModifyEntitySpecifics(entity_id, specifics)); 391 ASSERT_TRUE(GetFakeServer()->ModifyEntitySpecifics(entity_id, specifics));
394 392
395 const syncer::ModelTypeSet kBookmarksType(syncer::BOOKMARKS); 393 const syncer::ModelTypeSet kBookmarksType(syncer::BOOKMARKS);
396 TriggerSyncForModelTypes(kSingleProfileIndex, kBookmarksType); 394 TriggerSyncForModelTypes(kSingleProfileIndex, kBookmarksType);
397 395
398 ASSERT_TRUE(AwaitCountBookmarksWithUrlsMatching( 396 ASSERT_TRUE(BookmarksUrlChecker(kSingleProfileIndex, updated_url, 1).Wait());
399 kSingleProfileIndex, updated_url, 1));
400 ASSERT_EQ(0, CountBookmarksWithUrlsMatching(kSingleProfileIndex, 397 ASSERT_EQ(0, CountBookmarksWithUrlsMatching(kSingleProfileIndex,
401 original_url)); 398 original_url));
402 ASSERT_EQ(1, CountBookmarksWithTitlesMatching(kSingleProfileIndex, title)); 399 ASSERT_EQ(1, CountBookmarksWithTitlesMatching(kSingleProfileIndex, title));
403 } 400 }
404 401
405 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, DownloadBookmarkFolder) { 402 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, DownloadBookmarkFolder) {
406 const std::string title = "Seattle Sounders FC"; 403 const std::string title = "Seattle Sounders FC";
407 fake_server::EntityBuilderFactory entity_builder_factory; 404 fake_server::EntityBuilderFactory entity_builder_factory;
408 fake_server::BookmarkEntityBuilder bookmark_builder = 405 fake_server::BookmarkEntityBuilder bookmark_builder =
409 entity_builder_factory.NewBookmarkEntityBuilder(title); 406 entity_builder_factory.NewBookmarkEntityBuilder(title);
410 fake_server_->InjectEntity(bookmark_builder.BuildFolder()); 407 fake_server_->InjectEntity(bookmark_builder.BuildFolder());
411 408
412 DisableVerifier(); 409 DisableVerifier();
413 ASSERT_TRUE(SetupClients()); 410 ASSERT_TRUE(SetupClients());
414 ASSERT_EQ(0, CountFoldersWithTitlesMatching(kSingleProfileIndex, title)); 411 ASSERT_EQ(0, CountFoldersWithTitlesMatching(kSingleProfileIndex, title));
415 412
416 ASSERT_TRUE(SetupSync()); 413 ASSERT_TRUE(SetupSync());
417 414
418 ASSERT_EQ(1, CountFoldersWithTitlesMatching(kSingleProfileIndex, title)); 415 ASSERT_EQ(1, CountFoldersWithTitlesMatching(kSingleProfileIndex, title));
419 } 416 }
420 417
421 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, E2E_ONLY(SanitySetup)) { 418 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, E2E_ONLY(SanitySetup)) {
422 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 419 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
423 } 420 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698