| OLD | NEW |
| 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/prefs/pref_member.h" | 5 #include "chrome/browser/prefs/pref_member.h" |
| 6 #include "chrome/browser/prefs/pref_service.h" | 6 #include "chrome/browser/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/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| 10 #include "chrome/browser/sync/test/integration/passwords_helper.h" | 10 #include "chrome/browser/sync/test/integration/passwords_helper.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // In auto start enabled platforms like chrome os we should be | 93 // In auto start enabled platforms like chrome os we should be |
| 94 // able to set up even if the first sync while setting up fails. | 94 // able to set up even if the first sync while setting up fails. |
| 95 // Trigger error on every 2 out of 3 requests. | 95 // Trigger error on every 2 out of 3 requests. |
| 96 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_TWO_THIRDS); | 96 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_TWO_THIRDS); |
| 97 // Now setup sync and it should succeed. | 97 // Now setup sync and it should succeed. |
| 98 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 98 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 99 } else { | 99 } else { |
| 100 // In Non auto start enabled environments if the setup sync fails then | 100 // In Non auto start enabled environments if the setup sync fails then |
| 101 // the setup would fail. So setup sync normally. | 101 // the setup would fail. So setup sync normally. |
| 102 ASSERT_TRUE(SetupSync()) << "Setup sync failed"; | 102 ASSERT_TRUE(SetupSync()) << "Setup sync failed"; |
| 103 ASSERT_TRUE(clients()[0]->DisableSyncForDatatype(syncable::AUTOFILL)); | 103 ASSERT_TRUE(clients()[0]->DisableSyncForDatatype(syncer::AUTOFILL)); |
| 104 | 104 |
| 105 // Trigger error on every 2 out of 3 requests. | 105 // Trigger error on every 2 out of 3 requests. |
| 106 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_TWO_THIRDS); | 106 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_TWO_THIRDS); |
| 107 | 107 |
| 108 // Now enable a datatype, whose first 2 syncs would fail, but we should | 108 // Now enable a datatype, whose first 2 syncs would fail, but we should |
| 109 // recover and setup succesfully on the third attempt. | 109 // recover and setup succesfully on the third attempt. |
| 110 ASSERT_TRUE(clients()[0]->EnableSyncForDatatype(syncable::AUTOFILL)); | 110 ASSERT_TRUE(clients()[0]->EnableSyncForDatatype(syncer::AUTOFILL)); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 IN_PROC_BROWSER_TEST_F(SyncErrorTest, | 115 IN_PROC_BROWSER_TEST_F(SyncErrorTest, |
| 116 BirthdayErrorUsingActionableErrorTest) { | 116 BirthdayErrorUsingActionableErrorTest) { |
| 117 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 117 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 118 | 118 |
| 119 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); | 119 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); |
| 120 SetTitle(0, node1, L"new_title1"); | 120 SetTitle(0, node1, L"new_title1"); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); | 152 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); |
| 153 SetTitle(0, node2, L"new_title2"); | 153 SetTitle(0, node2, L"new_title2"); |
| 154 ASSERT_TRUE(GetClient(0)->AwaitExponentialBackoffVerification()); | 154 ASSERT_TRUE(GetClient(0)->AwaitExponentialBackoffVerification()); |
| 155 ASSERT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 155 ASSERT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
| 156 GetClient(0)->service()->GetAuthError().state()); | 156 GetClient(0)->service()->GetAuthError().state()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // TODO(lipalani): Fix the typed_url dtc so this test case can pass. | 159 // TODO(lipalani): Fix the typed_url dtc so this test case can pass. |
| 160 IN_PROC_BROWSER_TEST_F(SyncErrorTest, DISABLED_DisableDatatypeWhileRunning) { | 160 IN_PROC_BROWSER_TEST_F(SyncErrorTest, DISABLED_DisableDatatypeWhileRunning) { |
| 161 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 161 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 162 syncable::ModelTypeSet synced_datatypes = | 162 syncer::ModelTypeSet synced_datatypes = |
| 163 GetClient(0)->service()->GetPreferredDataTypes(); | 163 GetClient(0)->service()->GetPreferredDataTypes(); |
| 164 ASSERT_TRUE(synced_datatypes.Has(syncable::TYPED_URLS)); | 164 ASSERT_TRUE(synced_datatypes.Has(syncer::TYPED_URLS)); |
| 165 GetProfile(0)->GetPrefs()->SetBoolean( | 165 GetProfile(0)->GetPrefs()->SetBoolean( |
| 166 prefs::kSavingBrowserHistoryDisabled, true); | 166 prefs::kSavingBrowserHistoryDisabled, true); |
| 167 | 167 |
| 168 synced_datatypes = GetClient(0)->service()->GetPreferredDataTypes(); | 168 synced_datatypes = GetClient(0)->service()->GetPreferredDataTypes(); |
| 169 ASSERT_FALSE(synced_datatypes.Has(syncable::TYPED_URLS)); | 169 ASSERT_FALSE(synced_datatypes.Has(syncer::TYPED_URLS)); |
| 170 | 170 |
| 171 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); | 171 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); |
| 172 SetTitle(0, node1, L"new_title1"); | 172 SetTitle(0, node1, L"new_title1"); |
| 173 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Sync.")); | 173 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Sync.")); |
| 174 // TODO(lipalani)" Verify initial sync ended for typed url is false. | 174 // TODO(lipalani)" Verify initial sync ended for typed url is false. |
| 175 } | 175 } |
| 176 | 176 |
| OLD | NEW |