OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 template<> | 180 template<> |
181 syncer::ModelType GetModelType<AutofillEntry>() { | 181 syncer::ModelType GetModelType<AutofillEntry>() { |
182 return syncer::AUTOFILL; | 182 return syncer::AUTOFILL; |
183 } | 183 } |
184 | 184 |
185 template<> | 185 template<> |
186 syncer::ModelType GetModelType<AutofillProfile>() { | 186 syncer::ModelType GetModelType<AutofillProfile>() { |
187 return syncer::AUTOFILL_PROFILE; | 187 return syncer::AUTOFILL_PROFILE; |
188 } | 188 } |
189 | 189 |
190 class TokenWebDataServiceFake : public WebDataService { | 190 class TokenWebDataServiceFake : public TokenWebData { |
191 public: | 191 public: |
192 TokenWebDataServiceFake() | 192 TokenWebDataServiceFake() |
193 : WebDataService() { | 193 : TokenWebData() { |
194 } | 194 } |
195 | 195 |
196 virtual bool IsDatabaseLoaded() OVERRIDE { | 196 virtual bool IsDatabaseLoaded() OVERRIDE { |
197 return true; | 197 return true; |
198 } | 198 } |
199 | 199 |
200 virtual WebDataService::Handle GetAllTokens( | 200 virtual WebDataService::Handle GetAllTokens( |
201 WebDataServiceConsumer* consumer) OVERRIDE { | 201 WebDataServiceConsumer* consumer) OVERRIDE { |
202 // TODO(tim): It would be nice if WebDataService was injected on | 202 // TODO(tim): It would be nice if WebDataService was injected on |
203 // construction of TokenService rather than fetched by Initialize so that | 203 // construction of TokenService rather than fetched by Initialize so that |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 scoped_ptr<autofill::AutofillWebDataBackend> backend_; | 326 scoped_ptr<autofill::AutofillWebDataBackend> backend_; |
327 | 327 |
328 WaitableEvent syncable_service_created_or_destroyed_; | 328 WaitableEvent syncable_service_created_or_destroyed_; |
329 | 329 |
330 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake); | 330 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake); |
331 }; | 331 }; |
332 | 332 |
333 BrowserContextKeyedService* BuildMockWebDataServiceWrapper( | 333 BrowserContextKeyedService* BuildMockWebDataServiceWrapper( |
334 content::BrowserContext* profile) { | 334 content::BrowserContext* profile) { |
335 return new MockWebDataServiceWrapper( | 335 return new MockWebDataServiceWrapper( |
336 new TokenWebDataServiceFake(), | 336 NULL, |
337 new WebDataServiceFake()); | 337 new WebDataServiceFake(), |
| 338 new TokenWebDataServiceFake()); |
338 } | 339 } |
339 | 340 |
340 ACTION_P(MakeAutocompleteSyncComponents, wds) { | 341 ACTION_P(MakeAutocompleteSyncComponents, wds) { |
341 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 342 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
342 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) | 343 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) |
343 return base::WeakPtr<syncer::SyncableService>(); | 344 return base::WeakPtr<syncer::SyncableService>(); |
344 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); | 345 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); |
345 } | 346 } |
346 | 347 |
347 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { | 348 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 std::vector<AutofillEntry> sync_entries; | 1402 std::vector<AutofillEntry> sync_entries; |
1402 std::vector<AutofillProfile> sync_profiles; | 1403 std::vector<AutofillProfile> sync_profiles; |
1403 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1404 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
1404 EXPECT_EQ(3U, sync_entries.size()); | 1405 EXPECT_EQ(3U, sync_entries.size()); |
1405 EXPECT_EQ(0U, sync_profiles.size()); | 1406 EXPECT_EQ(0U, sync_profiles.size()); |
1406 for (size_t i = 0; i < sync_entries.size(); i++) { | 1407 for (size_t i = 0; i < sync_entries.size(); i++) { |
1407 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1408 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
1408 << ", " << sync_entries[i].key().value(); | 1409 << ", " << sync_entries[i].key().value(); |
1409 } | 1410 } |
1410 } | 1411 } |
OLD | NEW |