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

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

Issue 7861013: Fix the false-positive detection of commit errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another attempt at detecting errors Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/profiles/profile.h" 5 #include "chrome/browser/profiles/profile.h"
6 #include "chrome/browser/sync/profile_sync_service_harness.h" 6 #include "chrome/browser/sync/profile_sync_service_harness.h"
7 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 7 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
8 #include "chrome/browser/sync/test/integration/sync_test.h" 8 #include "chrome/browser/sync/test/integration/sync_test.h"
9 9
10 using bookmarks_helper::AddFolder; 10 using bookmarks_helper::AddFolder;
(...skipping 13 matching lines...) Expand all
24 private: 24 private:
25 DISALLOW_COPY_AND_ASSIGN(SingleClientBookmarksSyncTest); 25 DISALLOW_COPY_AND_ASSIGN(SingleClientBookmarksSyncTest);
26 }; 26 };
27 27
28 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, OfflineToOnline) { 28 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, OfflineToOnline) {
29 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 29 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
30 30
31 DisableNetwork(GetProfile(0)); 31 DisableNetwork(GetProfile(0));
32 const BookmarkNode* node = AddFolder(0, L"title"); 32 const BookmarkNode* node = AddFolder(0, L"title");
33 SetTitle(0, node, L"new_title"); 33 SetTitle(0, node, L"new_title");
34 ASSERT_FALSE(GetClient(0)->AwaitSyncCycleCompletion("Offline state change.")); 34 ASSERT_FALSE(GetClient(0)->AwaitFullSyncCompletion("Offline state change."));
35 ASSERT_EQ(ProfileSyncService::Status::OFFLINE_UNSYNCED, 35 ASSERT_EQ(ProfileSyncService::Status::OFFLINE_UNSYNCED,
36 GetClient(0)->GetStatus().summary); 36 GetClient(0)->GetStatus().summary);
37 37
38 EnableNetwork(GetProfile(0)); 38 EnableNetwork(GetProfile(0));
39 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Commit changes.")); 39 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Commit changes."));
40 ASSERT_EQ(ProfileSyncService::Status::READY, 40 ASSERT_EQ(ProfileSyncService::Status::READY,
41 GetClient(0)->GetStatus().summary); 41 GetClient(0)->GetStatus().summary);
42 ASSERT_TRUE(ModelMatchesVerifier(0)); 42 ASSERT_TRUE(ModelMatchesVerifier(0));
43 } 43 }
44 44
45 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { 45 IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) {
46 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 46 ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
47 47
48 // Starting state: 48 // Starting state:
49 // other_node 49 // other_node
(...skipping 10 matching lines...) Expand all
60 const BookmarkNode* tier1_a_url0 = AddURL( 60 const BookmarkNode* tier1_a_url0 = AddURL(
61 0, tier1_a, 0, L"tier1_a_url0", GURL("http://mail.google.com")); 61 0, tier1_a, 0, L"tier1_a_url0", GURL("http://mail.google.com"));
62 const BookmarkNode* tier1_a_url1 = AddURL( 62 const BookmarkNode* tier1_a_url1 = AddURL(
63 0, tier1_a, 1, L"tier1_a_url1", GURL("http://www.pandora.com")); 63 0, tier1_a, 1, L"tier1_a_url1", GURL("http://www.pandora.com"));
64 const BookmarkNode* tier1_a_url2 = AddURL( 64 const BookmarkNode* tier1_a_url2 = AddURL(
65 0, tier1_a, 2, L"tier1_a_url2", GURL("http://www.facebook.com")); 65 0, tier1_a, 2, L"tier1_a_url2", GURL("http://www.facebook.com"));
66 const BookmarkNode* tier1_b_url0 = AddURL( 66 const BookmarkNode* tier1_b_url0 = AddURL(
67 0, tier1_b, 0, L"tier1_b_url0", GURL("http://www.nhl.com")); 67 0, tier1_b, 0, L"tier1_b_url0", GURL("http://www.nhl.com"));
68 68
69 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 69 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
70 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 70 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion(
71 "Waiting for initial sync completed.")); 71 "Waiting for initial sync completed."));
72 ASSERT_TRUE(ModelMatchesVerifier(0)); 72 ASSERT_TRUE(ModelMatchesVerifier(0));
73 73
74 // Ultimately we want to end up with the following model; but this test is 74 // Ultimately we want to end up with the following model; but this test is
75 // more about the journey than the destination. 75 // more about the journey than the destination.
76 // 76 //
77 // bookmark_bar 77 // bookmark_bar
78 // -> CNN (www.cnn.com) 78 // -> CNN (www.cnn.com)
79 // -> tier1_a 79 // -> tier1_a
80 // -> tier1_a_url2 (www.facebook.com) 80 // -> tier1_a_url2 (www.facebook.com)
81 // -> tier1_a_url1 (www.pandora.com) 81 // -> tier1_a_url1 (www.pandora.com)
82 // -> Porsche (www.porsche.com) 82 // -> Porsche (www.porsche.com)
83 // -> Bank of America (www.bankofamerica.com) 83 // -> Bank of America (www.bankofamerica.com)
84 // -> Seattle Bubble 84 // -> Seattle Bubble
85 // other_node 85 // other_node
86 // -> top 86 // -> top
87 // -> tier1_b 87 // -> tier1_b
88 // -> Wired News (www.wired.com) 88 // -> Wired News (www.wired.com)
89 // -> tier2_b 89 // -> tier2_b
90 // -> tier1_b_url0 90 // -> tier1_b_url0
91 // -> tier3_b 91 // -> tier3_b
92 // -> Toronto Maple Leafs (mapleleafs.nhl.com) 92 // -> Toronto Maple Leafs (mapleleafs.nhl.com)
93 // -> Wynn (www.wynnlasvegas.com) 93 // -> Wynn (www.wynnlasvegas.com)
94 // -> tier1_a_url0 94 // -> tier1_a_url0
95 const BookmarkNode* bar = GetBookmarkBarNode(0); 95 const BookmarkNode* bar = GetBookmarkBarNode(0);
96 const BookmarkNode* cnn = AddURL(0, bar, 0, L"CNN", 96 const BookmarkNode* cnn = AddURL(0, bar, 0, L"CNN",
97 GURL("http://www.cnn.com")); 97 GURL("http://www.cnn.com"));
98 ASSERT_TRUE(cnn != NULL); 98 ASSERT_TRUE(cnn != NULL);
99 Move(0, tier1_a, bar, 1); 99 Move(0, tier1_a, bar, 1);
100 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Bookmark moved.")); 100 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Bookmark moved."));
101 ASSERT_TRUE(ModelMatchesVerifier(0)); 101 ASSERT_TRUE(ModelMatchesVerifier(0));
102 102
103 const BookmarkNode* porsche = AddURL(0, bar, 2, L"Porsche", 103 const BookmarkNode* porsche = AddURL(0, bar, 2, L"Porsche",
104 GURL("http://www.porsche.com")); 104 GURL("http://www.porsche.com"));
105 // Rearrange stuff in tier1_a. 105 // Rearrange stuff in tier1_a.
106 ASSERT_EQ(tier1_a, tier1_a_url2->parent()); 106 ASSERT_EQ(tier1_a, tier1_a_url2->parent());
107 ASSERT_EQ(tier1_a, tier1_a_url1->parent()); 107 ASSERT_EQ(tier1_a, tier1_a_url1->parent());
108 Move(0, tier1_a_url2, tier1_a, 0); 108 Move(0, tier1_a_url2, tier1_a, 0);
109 Move(0, tier1_a_url1, tier1_a, 2); 109 Move(0, tier1_a_url1, tier1_a, 2);
110 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 110 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion(
111 "Rearrange stuff in tier1_a")); 111 "Rearrange stuff in tier1_a"));
112 ASSERT_TRUE(ModelMatchesVerifier(0)); 112 ASSERT_TRUE(ModelMatchesVerifier(0));
113 113
114 ASSERT_EQ(1, tier1_a_url0->parent()->GetIndexOf(tier1_a_url0)); 114 ASSERT_EQ(1, tier1_a_url0->parent()->GetIndexOf(tier1_a_url0));
115 Move(0, tier1_a_url0, bar, bar->child_count()); 115 Move(0, tier1_a_url0, bar, bar->child_count());
116 const BookmarkNode* boa = AddURL(0, bar, bar->child_count(), 116 const BookmarkNode* boa = AddURL(0, bar, bar->child_count(),
117 L"Bank of America", GURL("https://www.bankofamerica.com")); 117 L"Bank of America", GURL("https://www.bankofamerica.com"));
118 ASSERT_TRUE(boa != NULL); 118 ASSERT_TRUE(boa != NULL);
119 Move(0, tier1_a_url0, top, top->child_count()); 119 Move(0, tier1_a_url0, top, top->child_count());
120 const BookmarkNode* bubble = AddURL( 120 const BookmarkNode* bubble = AddURL(
121 0, bar, bar->child_count(), L"Seattle Bubble", 121 0, bar, bar->child_count(), L"Seattle Bubble",
122 GURL("http://seattlebubble.com")); 122 GURL("http://seattlebubble.com"));
123 ASSERT_TRUE(bubble != NULL); 123 ASSERT_TRUE(bubble != NULL);
124 const BookmarkNode* wired = AddURL(0, bar, 2, L"Wired News", 124 const BookmarkNode* wired = AddURL(0, bar, 2, L"Wired News",
125 GURL("http://www.wired.com")); 125 GURL("http://www.wired.com"));
126 const BookmarkNode* tier2_b = AddFolder( 126 const BookmarkNode* tier2_b = AddFolder(
127 0, tier1_b, 0, L"tier2_b"); 127 0, tier1_b, 0, L"tier2_b");
128 Move(0, tier1_b_url0, tier2_b, 0); 128 Move(0, tier1_b_url0, tier2_b, 0);
129 Move(0, porsche, bar, 0); 129 Move(0, porsche, bar, 0);
130 SetTitle(0, wired, L"News Wired"); 130 SetTitle(0, wired, L"News Wired");
131 SetTitle(0, porsche, L"ICanHazPorsche?"); 131 SetTitle(0, porsche, L"ICanHazPorsche?");
132 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Change title.")); 132 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Change title."));
133 ASSERT_TRUE(ModelMatchesVerifier(0)); 133 ASSERT_TRUE(ModelMatchesVerifier(0));
134 134
135 ASSERT_EQ(tier1_a_url0->id(), top->GetChild(top->child_count() - 1)->id()); 135 ASSERT_EQ(tier1_a_url0->id(), top->GetChild(top->child_count() - 1)->id());
136 Remove(0, top, top->child_count() - 1); 136 Remove(0, top, top->child_count() - 1);
137 Move(0, wired, tier1_b, 0); 137 Move(0, wired, tier1_b, 0);
138 Move(0, porsche, bar, 3); 138 Move(0, porsche, bar, 3);
139 const BookmarkNode* tier3_b = AddFolder(0, tier2_b, 1, L"tier3_b"); 139 const BookmarkNode* tier3_b = AddFolder(0, tier2_b, 1, L"tier3_b");
140 const BookmarkNode* leafs = AddURL( 140 const BookmarkNode* leafs = AddURL(
141 0, tier1_a, 0, L"Toronto Maple Leafs", GURL("http://mapleleafs.nhl.com")); 141 0, tier1_a, 0, L"Toronto Maple Leafs", GURL("http://mapleleafs.nhl.com"));
142 const BookmarkNode* wynn = AddURL(0, bar, 1, L"Wynn", 142 const BookmarkNode* wynn = AddURL(0, bar, 1, L"Wynn",
143 GURL("http://www.wynnlasvegas.com")); 143 GURL("http://www.wynnlasvegas.com"));
144 144
145 Move(0, wynn, tier3_b, 0); 145 Move(0, wynn, tier3_b, 0);
146 Move(0, leafs, tier3_b, 0); 146 Move(0, leafs, tier3_b, 0);
147 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 147 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion(
148 "Move after addition of bookmarks.")); 148 "Move after addition of bookmarks."));
149 ASSERT_TRUE(ModelMatchesVerifier(0)); 149 ASSERT_TRUE(ModelMatchesVerifier(0));
150 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698