Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/sync/profile_sync_service.h" | |
| 5 #include "chrome/browser/sync/profile_sync_service_harness.h" | 6 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 7 #include "chrome/browser/sync/protocol/sync_protocol_error.h" | |
| 6 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| 7 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 8 | 10 |
| 9 using bookmarks_helper::AddFolder; | 11 using bookmarks_helper::AddFolder; |
| 10 using bookmarks_helper::SetTitle; | 12 using bookmarks_helper::SetTitle; |
| 11 | 13 |
| 12 class SyncErrorTest : public SyncTest{ | 14 class SyncErrorTest : public SyncTest{ |
| 13 public: | 15 public: |
| 14 SyncErrorTest() : SyncTest(SINGLE_CLIENT) {} | 16 SyncErrorTest() : SyncTest(SINGLE_CLIENT) {} |
| 15 virtual ~SyncErrorTest() {} | 17 virtual ~SyncErrorTest() {} |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 39 SetTitle(0, node1, L"new_title1"); | 41 SetTitle(0, node1, L"new_title1"); |
| 40 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Offline state change.")); | 42 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Offline state change.")); |
| 41 TriggerTransientError(); | 43 TriggerTransientError(); |
| 42 | 44 |
| 43 // Now make one more change so we will do another sync. | 45 // Now make one more change so we will do another sync. |
| 44 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); | 46 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); |
| 45 SetTitle(0, node2, L"new_title2"); | 47 SetTitle(0, node2, L"new_title2"); |
| 46 ASSERT_TRUE( | 48 ASSERT_TRUE( |
| 47 GetClient(0)->AwaitExponentialBackoffVerification()); | 49 GetClient(0)->AwaitExponentialBackoffVerification()); |
| 48 } | 50 } |
| 51 | |
| 52 IN_PROC_BROWSER_TEST_F(SyncErrorTest, ActionableErrorTest) { | |
| 53 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | |
| 54 | |
| 55 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); | |
| 56 SetTitle(0, node1, L"new_title1"); | |
| 57 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Sync.")); | |
| 58 | |
| 59 browser_sync::SyncProtocolError protocol_error; | |
| 60 protocol_error.error_type = browser_sync::TRANSIENT_ERROR; | |
| 61 protocol_error.action = browser_sync::UPGRADE_CLIENT; | |
| 62 protocol_error.error_description = "Not My Fault"; | |
| 63 protocol_error.url = "www.google.com"; | |
| 64 TriggerSyncError(protocol_error); | |
| 65 | |
| 66 // Now make one more change so we will do another sync. | |
| 67 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); | |
| 68 SetTitle(0, node2, L"new_title2"); | |
| 69 ASSERT_TRUE( | |
| 70 GetClient(0)->AwaitActionableError()); | |
| 71 ProfileSyncService::Status status = GetClient(0)->GetStatus(); | |
| 72 ASSERT_EQ(status.sync_protocol_error.error_type, protocol_error.error_type); | |
| 73 ASSERT_EQ(status.sync_protocol_error.action, protocol_error.action); | |
| 74 ASSERT_EQ(status.sync_protocol_error.url, protocol_error.url); | |
| 75 ASSERT_EQ(status.sync_protocol_error.error_description, | |
| 76 protocol_error.error_description); | |
| 77 } | |
| 78 | |
| 79 IN_PROC_BROWSER_TEST_F(SyncErrorTest, | |
| 80 BirthdayErrorUsingActionableErrorTest) { | |
| 81 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | |
| 82 | |
| 83 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); | |
| 84 SetTitle(0, node1, L"new_title1"); | |
| 85 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Sync.")); | |
| 86 | |
| 87 browser_sync::SyncProtocolError protocol_error; | |
| 88 protocol_error.error_type = browser_sync::NOT_MY_BIRTHDAY; | |
| 89 protocol_error.action = browser_sync::DISABLE_SYNC_ON_CLIENT; | |
| 90 protocol_error.error_description = "Not My Fault"; | |
| 91 protocol_error.url = "www.google.com"; | |
| 92 TriggerSyncError(protocol_error); | |
| 93 | |
| 94 // Now make one more change so we will do another sync. | |
| 95 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); | |
| 96 SetTitle(0, node2, L"new_title2"); | |
| 97 ASSERT_TRUE( | |
| 98 GetClient(0)->AwaitSyncDisabled("Birthday Error.")); | |
| 99 ProfileSyncService::Status status = GetClient(0)->GetStatus(); | |
| 100 ASSERT_EQ(status.sync_protocol_error.error_type, protocol_error.error_type); | |
| 101 ASSERT_EQ(status.sync_protocol_error.action, protocol_error.action); | |
| 102 ASSERT_EQ(status.sync_protocol_error.url, protocol_error.url); | |
| 103 ASSERT_EQ(status.sync_protocol_error.error_description, | |
| 104 protocol_error.error_description); | |
| 105 } | |
| 106 | |
|
Raghu Simha
2011/09/16 04:01:02
Remove extra blank line.
lipalani1
2011/09/19 18:59:13
Done.
| |
| OLD | NEW |