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 "base/tracked.h" | 5 #include "base/tracked.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/sync/glue/autofill_profile_syncable_service.h" | 7 #include "chrome/browser/sync/glue/autofill_profile_syncable_service.h" |
8 #include "chrome/browser/sync/internal_api/read_node_mock.h" | 8 #include "chrome/browser/sync/internal_api/read_node_mock.h" |
9 #include "chrome/browser/sync/internal_api/syncapi_mock.h" | 9 #include "chrome/browser/sync/internal_api/syncapi_mock.h" |
10 #include "chrome/browser/sync/syncable/syncable.h" | 10 #include "chrome/browser/sync/syncable/syncable.h" |
11 #include "chrome/browser/sync/syncable/syncable_mock.h" | 11 #include "chrome/browser/sync/syncable/syncable_mock.h" |
| 12 #include "chrome/browser/webdata/autofill_change.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 using ::testing::_; | 16 using ::testing::_; |
16 using ::testing::DoAll; | 17 using ::testing::DoAll; |
17 using ::testing::Eq; | 18 using ::testing::Eq; |
18 using ::testing::Return; | 19 using ::testing::Return; |
19 using ::testing::Property; | 20 using ::testing::Property; |
20 class AutofillProfile; | 21 class AutofillProfile; |
21 | 22 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 .WillOnce(Return(true)); | 236 .WillOnce(Return(true)); |
236 | 237 |
237 MockAutofillProfileSyncableService::AutoSetSyncProcessor temp( | 238 MockAutofillProfileSyncableService::AutoSetSyncProcessor temp( |
238 &autofill_syncable_service_, &sync_processor_); | 239 &autofill_syncable_service_, &sync_processor_); |
239 SyncError error = autofill_syncable_service_.ProcessSyncChanges( | 240 SyncError error = autofill_syncable_service_.ProcessSyncChanges( |
240 FROM_HERE, change_list); | 241 FROM_HERE, change_list); |
241 | 242 |
242 EXPECT_FALSE(error.IsSet()); | 243 EXPECT_FALSE(error.IsSet()); |
243 } | 244 } |
244 | 245 |
| 246 TEST_F(AutofillProfileSyncableServiceTest, ActOnChange) { |
| 247 std::string guid1 = "EDC609ED-7EEE-4F27-B00C-423242A9C44B"; |
| 248 std::string guid2 = "EDC609ED-7EEE-4F27-B00C-423242A9C44C"; |
| 249 |
| 250 AutofillProfile profile(guid1); |
| 251 profile.SetInfo(NAME_FIRST, UTF8ToUTF16("Jane")); |
| 252 AutofillProfileChange change1(AutofillProfileChange::ADD, guid1, &profile); |
| 253 AutofillProfileChange change2(AutofillProfileChange::REMOVE, guid2, NULL); |
| 254 ON_CALL(sync_processor_, ProcessSyncChanges(_, _)) |
| 255 .WillByDefault(Return(SyncError(FROM_HERE, std::string("an error"), |
| 256 syncable::AUTOFILL_PROFILE))); |
| 257 |
| 258 MockAutofillProfileSyncableService::AutoSetSyncProcessor temp( |
| 259 &autofill_syncable_service_, &sync_processor_); |
| 260 autofill_syncable_service_.ActOnChange(change1); |
| 261 autofill_syncable_service_.ActOnChange(change2); |
| 262 } |
| 263 |
245 } // namespace browser_sync | 264 } // namespace browser_sync |
246 | 265 |
OLD | NEW |