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

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

Issue 2791793002: [Sync] Fix flaky TwoClientAutofillSyncTest.ConflictingFields. (Closed)
Patch Set: Updated for Pavel's comment. Created 3 years, 8 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 "chrome/browser/sync/test/integration/sync_test.h" 5 #include "chrome/browser/sync/test/integration/sync_test.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 return BuildP2PProfileInvalidationProvider(context, syncer::NOTIFY_OTHERS); 208 return BuildP2PProfileInvalidationProvider(context, syncer::NOTIFY_OTHERS);
209 } 209 }
210 210
211 } // namespace 211 } // namespace
212 212
213 SyncTest::SyncTest(TestType test_type) 213 SyncTest::SyncTest(TestType test_type)
214 : test_type_(test_type), 214 : test_type_(test_type),
215 server_type_(SERVER_TYPE_UNDECIDED), 215 server_type_(SERVER_TYPE_UNDECIDED),
216 num_clients_(-1), 216 num_clients_(-1),
217 use_verifier_(true), 217 use_verifier_(true),
218 notifications_enabled_(true),
219 create_gaia_account_at_runtime_(false) { 218 create_gaia_account_at_runtime_(false) {
220 sync_datatype_helper::AssociateWithTest(this); 219 sync_datatype_helper::AssociateWithTest(this);
221 switch (test_type_) { 220 switch (test_type_) {
222 case SINGLE_CLIENT: 221 case SINGLE_CLIENT:
223 case SINGLE_CLIENT_LEGACY: { 222 case SINGLE_CLIENT_LEGACY: {
224 num_clients_ = 1; 223 num_clients_ = 1;
225 break; 224 break;
226 } 225 }
227 case TWO_CLIENT: 226 case TWO_CLIENT:
228 case TWO_CLIENT_LEGACY: { 227 case TWO_CLIENT_LEGACY: {
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 std::string path = "chromiumsync/disablenotifications"; 1112 std::string path = "chromiumsync/disablenotifications";
1114 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); 1113 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
1115 ASSERT_EQ("Notifications disabled", 1114 ASSERT_EQ("Notifications disabled",
1116 base::UTF16ToASCII( 1115 base::UTF16ToASCII(
1117 browser()->tab_strip_model()->GetActiveWebContents()-> 1116 browser()->tab_strip_model()->GetActiveWebContents()->
1118 GetTitle())); 1117 GetTitle()));
1119 } 1118 }
1120 1119
1121 void SyncTest::DisableNotifications() { 1120 void SyncTest::DisableNotifications() {
1122 DisableNotificationsImpl(); 1121 DisableNotificationsImpl();
1123 notifications_enabled_ = false;
1124 } 1122 }
1125 1123
1126 void SyncTest::EnableNotificationsImpl() { 1124 void SyncTest::EnableNotificationsImpl() {
1127 ASSERT_TRUE(ServerSupportsNotificationControl()); 1125 ASSERT_TRUE(ServerSupportsNotificationControl());
1128 std::string path = "chromiumsync/enablenotifications"; 1126 std::string path = "chromiumsync/enablenotifications";
1129 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); 1127 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
1130 ASSERT_EQ("Notifications enabled", 1128 ASSERT_EQ("Notifications enabled",
1131 base::UTF16ToASCII( 1129 base::UTF16ToASCII(
1132 browser()->tab_strip_model()->GetActiveWebContents()-> 1130 browser()->tab_strip_model()->GetActiveWebContents()->
1133 GetTitle())); 1131 GetTitle()));
1134 } 1132 }
1135 1133
1136 void SyncTest::EnableNotifications() { 1134 void SyncTest::EnableNotifications() {
1137 EnableNotificationsImpl(); 1135 EnableNotificationsImpl();
1138 notifications_enabled_ = true;
1139 } 1136 }
1140 1137
1141 void SyncTest::TriggerNotification(syncer::ModelTypeSet changed_types) { 1138 void SyncTest::TriggerNotification(syncer::ModelTypeSet changed_types) {
1142 ASSERT_TRUE(ServerSupportsNotificationControl()); 1139 ASSERT_TRUE(ServerSupportsNotificationControl());
1143 const std::string& data = 1140 const std::string& data =
1144 syncer::P2PNotificationData( 1141 syncer::P2PNotificationData(
1145 "from_server", 1142 "from_server",
1146 syncer::NOTIFY_ALL, 1143 syncer::NOTIFY_ALL,
1147 syncer::ObjectIdInvalidationMap::InvalidateAll( 1144 syncer::ObjectIdInvalidationMap::InvalidateAll(
1148 syncer::ModelTypeSetToObjectIdSet(changed_types))).ToString(); 1145 syncer::ModelTypeSetToObjectIdSet(changed_types))).ToString();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 bool SyncTest::ClearServerData(ProfileSyncServiceHarness* harness) { 1220 bool SyncTest::ClearServerData(ProfileSyncServiceHarness* harness) {
1224 // At this point our birthday is good. 1221 // At this point our birthday is good.
1225 base::RunLoop run_loop; 1222 base::RunLoop run_loop;
1226 harness->service()->ClearServerDataForTest(run_loop.QuitClosure()); 1223 harness->service()->ClearServerDataForTest(run_loop.QuitClosure());
1227 run_loop.Run(); 1224 run_loop.Run();
1228 1225
1229 // Our birthday is invalidated on the server here so restart sync to get 1226 // Our birthday is invalidated on the server here so restart sync to get
1230 // the new birthday from the server. 1227 // the new birthday from the server.
1231 return harness->RestartSyncService(); 1228 return harness->RestartSyncService();
1232 } 1229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698