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/location.h" | 5 #include "base/location.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autofill/autofill_profile.h" | 7 #include "chrome/browser/autofill/autofill_profile.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_profile_syncable_service.h" | 12 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" |
13 #include "content/browser/browser_thread.h" | 13 #include "content/browser/browser_thread.h" |
14 #include "chrome/browser/webdata/autofill_change.h" | 14 #include "chrome/browser/webdata/autofill_change.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using ::testing::_; | 18 using ::testing::_; |
19 using ::testing::DoAll; | 19 using ::testing::DoAll; |
20 using ::testing::Eq; | 20 using ::testing::Eq; |
21 using ::testing::Return; | 21 using ::testing::Return; |
22 using ::testing::Property; | 22 using ::testing::Property; |
23 class AutofillProfile; | 23 class AutofillProfile; |
24 | 24 |
25 namespace browser_sync { | |
26 | |
27 class MockAutofillProfileSyncableService | 25 class MockAutofillProfileSyncableService |
28 : public browser_sync::AutofillProfileSyncableService { | 26 : public AutofillProfileSyncableService { |
29 public: | 27 public: |
30 MockAutofillProfileSyncableService() { | 28 MockAutofillProfileSyncableService() { |
31 } | 29 } |
32 virtual ~MockAutofillProfileSyncableService() {} | 30 virtual ~MockAutofillProfileSyncableService() {} |
33 | 31 |
34 MOCK_METHOD1(LoadAutofillData, bool(std::vector<AutofillProfile*>*)); | 32 MOCK_METHOD1(LoadAutofillData, bool(std::vector<AutofillProfile*>*)); |
35 MOCK_METHOD1(SaveChangesToWebData, | 33 MOCK_METHOD1(SaveChangesToWebData, |
36 bool(const AutofillProfileSyncableService::DataBundle&)); | 34 bool(const AutofillProfileSyncableService::DataBundle&)); |
37 | 35 |
38 // Helper for tests that do not need to setup service completely through the | 36 // Helper for tests that do not need to setup service completely through the |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 AutofillProfileChange change2(AutofillProfileChange::REMOVE, guid2, NULL); | 253 AutofillProfileChange change2(AutofillProfileChange::REMOVE, guid2, NULL); |
256 ON_CALL(sync_processor_, ProcessSyncChanges(_, _)) | 254 ON_CALL(sync_processor_, ProcessSyncChanges(_, _)) |
257 .WillByDefault(Return(SyncError(FROM_HERE, std::string("an error"), | 255 .WillByDefault(Return(SyncError(FROM_HERE, std::string("an error"), |
258 syncable::AUTOFILL_PROFILE))); | 256 syncable::AUTOFILL_PROFILE))); |
259 | 257 |
260 MockAutofillProfileSyncableService::AutoSetSyncProcessor temp( | 258 MockAutofillProfileSyncableService::AutoSetSyncProcessor temp( |
261 &autofill_syncable_service_, &sync_processor_); | 259 &autofill_syncable_service_, &sync_processor_); |
262 autofill_syncable_service_.ActOnChange(change1); | 260 autofill_syncable_service_.ActOnChange(change1); |
263 autofill_syncable_service_.ActOnChange(change2); | 261 autofill_syncable_service_.ActOnChange(change2); |
264 } | 262 } |
265 | |
266 } // namespace browser_sync | |
OLD | NEW |