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

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

Issue 148723002: [sync] Eliminate Await*SyncCompletion methods in integration tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address feedback Created 6 years, 10 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) 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 "base/prefs/pref_member.h" 5 #include "base/prefs/pref_member.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "chrome/browser/sync/profile_sync_service.h" 7 #include "chrome/browser/sync/profile_sync_service.h"
8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
9 #include "chrome/browser/sync/test/integration/passwords_helper.h" 9 #include "chrome/browser/sync/test/integration/passwords_helper.h"
10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 DISALLOW_COPY_AND_ASSIGN(ActionableErrorChecker); 54 DISALLOW_COPY_AND_ASSIGN(ActionableErrorChecker);
55 }; 55 };
56 56
57 IN_PROC_BROWSER_TEST_F(SyncErrorTest, BirthdayErrorTest) { 57 IN_PROC_BROWSER_TEST_F(SyncErrorTest, BirthdayErrorTest) {
58 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 58 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
59 59
60 // Add an item, wait for sync, and trigger a birthday error on the server. 60 // Add an item, wait for sync, and trigger a birthday error on the server.
61 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); 61 const BookmarkNode* node1 = AddFolder(0, 0, L"title1");
62 SetTitle(0, node1, L"new_title1"); 62 SetTitle(0, node1, L"new_title1");
63 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion()); 63 ASSERT_TRUE(GetClient(0)->AwaitCommitActivityCompletion());
64 TriggerBirthdayError(); 64 TriggerBirthdayError();
65 65
66 // Now make one more change so we will do another sync. 66 // Now make one more change so we will do another sync.
67 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); 67 const BookmarkNode* node2 = AddFolder(0, 0, L"title2");
68 SetTitle(0, node2, L"new_title2"); 68 SetTitle(0, node2, L"new_title2");
69 ASSERT_TRUE(GetClient(0)->AwaitSyncDisabled()); 69 ASSERT_TRUE(GetClient(0)->AwaitSyncDisabled());
70 } 70 }
71 71
72 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ActionableErrorTest) { 72 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ActionableErrorTest) {
73 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 73 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
74 74
75 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); 75 const BookmarkNode* node1 = AddFolder(0, 0, L"title1");
76 SetTitle(0, node1, L"new_title1"); 76 SetTitle(0, node1, L"new_title1");
77 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion()); 77 ASSERT_TRUE(GetClient(0)->AwaitCommitActivityCompletion());
78 78
79 syncer::SyncProtocolError protocol_error; 79 syncer::SyncProtocolError protocol_error;
80 protocol_error.error_type = syncer::TRANSIENT_ERROR; 80 protocol_error.error_type = syncer::TRANSIENT_ERROR;
81 protocol_error.action = syncer::UPGRADE_CLIENT; 81 protocol_error.action = syncer::UPGRADE_CLIENT;
82 protocol_error.error_description = "Not My Fault"; 82 protocol_error.error_description = "Not My Fault";
83 protocol_error.url = "www.google.com"; 83 protocol_error.url = "www.google.com";
84 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS); 84 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS);
85 85
86 // Now make one more change so we will do another sync. 86 // Now make one more change so we will do another sync.
87 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); 87 const BookmarkNode* node2 = AddFolder(0, 0, L"title2");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 ASSERT_TRUE(clients()[0]->EnableSyncForDatatype(syncer::AUTOFILL)); 129 ASSERT_TRUE(clients()[0]->EnableSyncForDatatype(syncer::AUTOFILL));
130 } 130 }
131 } 131 }
132 132
133 IN_PROC_BROWSER_TEST_F(SyncErrorTest, 133 IN_PROC_BROWSER_TEST_F(SyncErrorTest,
134 BirthdayErrorUsingActionableErrorTest) { 134 BirthdayErrorUsingActionableErrorTest) {
135 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 135 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
136 136
137 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); 137 const BookmarkNode* node1 = AddFolder(0, 0, L"title1");
138 SetTitle(0, node1, L"new_title1"); 138 SetTitle(0, node1, L"new_title1");
139 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion()); 139 ASSERT_TRUE(GetClient(0)->AwaitCommitActivityCompletion());
140 140
141 syncer::SyncProtocolError protocol_error; 141 syncer::SyncProtocolError protocol_error;
142 protocol_error.error_type = syncer::NOT_MY_BIRTHDAY; 142 protocol_error.error_type = syncer::NOT_MY_BIRTHDAY;
143 protocol_error.action = syncer::DISABLE_SYNC_ON_CLIENT; 143 protocol_error.action = syncer::DISABLE_SYNC_ON_CLIENT;
144 protocol_error.error_description = "Not My Fault"; 144 protocol_error.error_description = "Not My Fault";
145 protocol_error.url = "www.google.com"; 145 protocol_error.url = "www.google.com";
146 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS); 146 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS);
147 147
148 // Now make one more change so we will do another sync. 148 // Now make one more change so we will do another sync.
149 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); 149 const BookmarkNode* node2 = AddFolder(0, 0, L"title2");
(...skipping 14 matching lines...) Expand all
164 GetClient(0)->service()->GetPreferredDataTypes(); 164 GetClient(0)->service()->GetPreferredDataTypes();
165 ASSERT_TRUE(synced_datatypes.Has(syncer::TYPED_URLS)); 165 ASSERT_TRUE(synced_datatypes.Has(syncer::TYPED_URLS));
166 GetProfile(0)->GetPrefs()->SetBoolean( 166 GetProfile(0)->GetPrefs()->SetBoolean(
167 prefs::kSavingBrowserHistoryDisabled, true); 167 prefs::kSavingBrowserHistoryDisabled, true);
168 168
169 synced_datatypes = GetClient(0)->service()->GetPreferredDataTypes(); 169 synced_datatypes = GetClient(0)->service()->GetPreferredDataTypes();
170 ASSERT_FALSE(synced_datatypes.Has(syncer::TYPED_URLS)); 170 ASSERT_FALSE(synced_datatypes.Has(syncer::TYPED_URLS));
171 171
172 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); 172 const BookmarkNode* node1 = AddFolder(0, 0, L"title1");
173 SetTitle(0, node1, L"new_title1"); 173 SetTitle(0, node1, L"new_title1");
174 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion()); 174 ASSERT_TRUE(GetClient(0)->AwaitCommitActivityCompletion());
175 // TODO(lipalani)" Verify initial sync ended for typed url is false. 175 // TODO(lipalani)" Verify initial sync ended for typed url is false.
176 } 176 }
177 177
178 } // namespace 178 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698