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.h" |
6 #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" | 7 #include "chrome/browser/sync/protocol/sync_protocol_error.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/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
11 #include "chrome/common/net/gaia/google_service_auth_error.h" | 11 #include "chrome/common/net/gaia/google_service_auth_error.h" |
12 | 12 |
13 using bookmarks_helper::AddFolder; | 13 using bookmarks_helper::AddFolder; |
14 using bookmarks_helper::SetTitle; | 14 using bookmarks_helper::SetTitle; |
15 using passwords_helper::AddLogin; | |
16 using passwords_helper::CreateTestPasswordForm; | |
17 using passwords_helper::GetPasswordCount; | |
18 using passwords_helper::GetPasswordStore; | |
19 using passwords_helper::GetVerifierPasswordCount; | |
20 using passwords_helper::GetVerifierPasswordStore; | |
21 using passwords_helper::ProfileContainsSamePasswordFormsAsVerifier; | |
22 | |
23 using webkit::forms::PasswordForm; | |
24 | 15 |
25 class SyncErrorTest : public SyncTest{ | 16 class SyncErrorTest : public SyncTest{ |
26 public: | 17 public: |
27 SyncErrorTest() : SyncTest(SINGLE_CLIENT) {} | 18 SyncErrorTest() : SyncTest(SINGLE_CLIENT) {} |
28 virtual ~SyncErrorTest() {} | 19 virtual ~SyncErrorTest() {} |
29 | 20 |
30 private: | 21 private: |
31 DISALLOW_COPY_AND_ASSIGN(SyncErrorTest); | 22 DISALLOW_COPY_AND_ASSIGN(SyncErrorTest); |
32 }; | 23 }; |
33 | 24 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ASSERT_TRUE( | 99 ASSERT_TRUE( |
109 GetClient(0)->AwaitSyncDisabled("Birthday Error.")); | 100 GetClient(0)->AwaitSyncDisabled("Birthday Error.")); |
110 ProfileSyncService::Status status = GetClient(0)->GetStatus(); | 101 ProfileSyncService::Status status = GetClient(0)->GetStatus(); |
111 ASSERT_EQ(status.sync_protocol_error.error_type, protocol_error.error_type); | 102 ASSERT_EQ(status.sync_protocol_error.error_type, protocol_error.error_type); |
112 ASSERT_EQ(status.sync_protocol_error.action, protocol_error.action); | 103 ASSERT_EQ(status.sync_protocol_error.action, protocol_error.action); |
113 ASSERT_EQ(status.sync_protocol_error.url, protocol_error.url); | 104 ASSERT_EQ(status.sync_protocol_error.url, protocol_error.url); |
114 ASSERT_EQ(status.sync_protocol_error.error_description, | 105 ASSERT_EQ(status.sync_protocol_error.error_description, |
115 protocol_error.error_description); | 106 protocol_error.error_description); |
116 } | 107 } |
117 | 108 |
118 // TODO(rsimha): Enable after fixing crbug.com/107611. | 109 IN_PROC_BROWSER_TEST_F(SyncErrorTest, AuthErrorTest) { |
119 IN_PROC_BROWSER_TEST_F(SyncErrorTest, DISABLED_AuthErrorTest) { | |
120 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 110 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
121 | 111 |
122 PasswordForm form0 = CreateTestPasswordForm(0); | 112 const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); |
123 AddLogin(GetVerifierPasswordStore(), form0); | 113 SetTitle(0, node1, L"new_title1"); |
124 ASSERT_EQ(1, GetVerifierPasswordCount()); | 114 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Sync.")); |
125 AddLogin(GetPasswordStore(0), form0); | |
126 ASSERT_EQ(1, GetPasswordCount(0)); | |
127 | |
128 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Added a login.")); | |
129 ASSERT_TRUE(ProfileContainsSamePasswordFormsAsVerifier(0)); | |
130 ASSERT_EQ(1, GetPasswordCount(0)); | |
131 | 115 |
132 TriggerAuthError(); | 116 TriggerAuthError(); |
133 PasswordForm form1 = CreateTestPasswordForm(1); | 117 |
134 AddLogin(GetPasswordStore(0), form1); | 118 const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); |
| 119 SetTitle(0, node2, L"new_title2"); |
135 ASSERT_FALSE(GetClient(0)->AwaitFullSyncCompletion("Must get auth error.")); | 120 ASSERT_FALSE(GetClient(0)->AwaitFullSyncCompletion("Must get auth error.")); |
136 ASSERT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 121 ASSERT_EQ(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
137 GetClient(0)->service()->GetAuthError().state()); | 122 GetClient(0)->service()->GetAuthError().state()); |
138 ASSERT_EQ(ProfileSyncService::Status::OFFLINE_UNSYNCED, | 123 ASSERT_EQ(ProfileSyncService::Status::OFFLINE_UNSYNCED, |
139 GetClient(0)->GetStatus().summary); | 124 GetClient(0)->GetStatus().summary); |
140 } | 125 } |
OLD | NEW |