| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 GetClient(0)->AwaitExponentialBackoffVerification()); | 54 GetClient(0)->AwaitExponentialBackoffVerification()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ActionableErrorTest) { | 57 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ActionableErrorTest) { |
| 58 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 58 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 59 | 59 |
| 60 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); | 60 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); |
| 61 SetTitle(0, node1, L"new_title1"); | 61 SetTitle(0, node1, L"new_title1"); |
| 62 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Sync.")); | 62 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Sync.")); |
| 63 | 63 |
| 64 csync::SyncProtocolError protocol_error; | 64 syncer::SyncProtocolError protocol_error; |
| 65 protocol_error.error_type = csync::TRANSIENT_ERROR; | 65 protocol_error.error_type = syncer::TRANSIENT_ERROR; |
| 66 protocol_error.action = csync::UPGRADE_CLIENT; | 66 protocol_error.action = syncer::UPGRADE_CLIENT; |
| 67 protocol_error.error_description = "Not My Fault"; | 67 protocol_error.error_description = "Not My Fault"; |
| 68 protocol_error.url = "www.google.com"; | 68 protocol_error.url = "www.google.com"; |
| 69 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS); | 69 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS); |
| 70 | 70 |
| 71 // Now make one more change so we will do another sync. | 71 // Now make one more change so we will do another sync. |
| 72 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); | 72 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); |
| 73 SetTitle(0, node2, L"new_title2"); | 73 SetTitle(0, node2, L"new_title2"); |
| 74 ASSERT_TRUE( | 74 ASSERT_TRUE( |
| 75 GetClient(0)->AwaitActionableError()); | 75 GetClient(0)->AwaitActionableError()); |
| 76 ProfileSyncService::Status status = GetClient(0)->GetStatus(); | 76 ProfileSyncService::Status status = GetClient(0)->GetStatus(); |
| 77 ASSERT_EQ(status.sync_protocol_error.error_type, protocol_error.error_type); | 77 ASSERT_EQ(status.sync_protocol_error.error_type, protocol_error.error_type); |
| 78 ASSERT_EQ(status.sync_protocol_error.action, protocol_error.action); | 78 ASSERT_EQ(status.sync_protocol_error.action, protocol_error.action); |
| 79 ASSERT_EQ(status.sync_protocol_error.url, protocol_error.url); | 79 ASSERT_EQ(status.sync_protocol_error.url, protocol_error.url); |
| 80 ASSERT_EQ(status.sync_protocol_error.error_description, | 80 ASSERT_EQ(status.sync_protocol_error.error_description, |
| 81 protocol_error.error_description); | 81 protocol_error.error_description); |
| 82 } | 82 } |
| 83 | 83 |
| 84 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ErrorWhileSettingUp) { | 84 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ErrorWhileSettingUp) { |
| 85 ASSERT_TRUE(SetupClients()); | 85 ASSERT_TRUE(SetupClients()); |
| 86 | 86 |
| 87 csync::SyncProtocolError protocol_error; | 87 syncer::SyncProtocolError protocol_error; |
| 88 protocol_error.error_type = csync::TRANSIENT_ERROR; | 88 protocol_error.error_type = syncer::TRANSIENT_ERROR; |
| 89 protocol_error.error_description = "Not My Fault"; | 89 protocol_error.error_description = "Not My Fault"; |
| 90 protocol_error.url = "www.google.com"; | 90 protocol_error.url = "www.google.com"; |
| 91 | 91 |
| 92 if (clients()[0]->AutoStartEnabled()) { | 92 if (clients()[0]->AutoStartEnabled()) { |
| 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."; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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"); |
| 121 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Sync.")); | 121 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Sync.")); |
| 122 | 122 |
| 123 csync::SyncProtocolError protocol_error; | 123 syncer::SyncProtocolError protocol_error; |
| 124 protocol_error.error_type = csync::NOT_MY_BIRTHDAY; | 124 protocol_error.error_type = syncer::NOT_MY_BIRTHDAY; |
| 125 protocol_error.action = csync::DISABLE_SYNC_ON_CLIENT; | 125 protocol_error.action = syncer::DISABLE_SYNC_ON_CLIENT; |
| 126 protocol_error.error_description = "Not My Fault"; | 126 protocol_error.error_description = "Not My Fault"; |
| 127 protocol_error.url = "www.google.com"; | 127 protocol_error.url = "www.google.com"; |
| 128 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS); | 128 TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS); |
| 129 | 129 |
| 130 // Now make one more change so we will do another sync. | 130 // Now make one more change so we will do another sync. |
| 131 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); | 131 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); |
| 132 SetTitle(0, node2, L"new_title2"); | 132 SetTitle(0, node2, L"new_title2"); |
| 133 ASSERT_TRUE( | 133 ASSERT_TRUE( |
| 134 GetClient(0)->AwaitSyncDisabled("Birthday Error.")); | 134 GetClient(0)->AwaitSyncDisabled("Birthday Error.")); |
| 135 ProfileSyncService::Status status = GetClient(0)->GetStatus(); | 135 ProfileSyncService::Status status = GetClient(0)->GetStatus(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(syncable::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 |