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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 TokenWebDataServiceFake() | 202 TokenWebDataServiceFake() |
203 : TokenWebData( | 203 : TokenWebData( |
204 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 204 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
205 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)) { | 205 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)) { |
206 } | 206 } |
207 | 207 |
208 virtual bool IsDatabaseLoaded() OVERRIDE { | 208 virtual bool IsDatabaseLoaded() OVERRIDE { |
209 return true; | 209 return true; |
210 } | 210 } |
211 | 211 |
212 virtual WebDataService::Handle GetAllTokens( | 212 virtual AutofillWebDataService::Handle GetAllTokens( |
213 WebDataServiceConsumer* consumer) OVERRIDE { | 213 WebDataServiceConsumer* consumer) OVERRIDE { |
214 // TODO(tim): It would be nice if WebDataService was injected on | 214 // TODO(tim): It would be nice if WebDataService was injected on |
215 // construction of ProfileOAuth2TokenService rather than fetched by | 215 // construction of ProfileOAuth2TokenService rather than fetched by |
216 // Initialize so that this isn't necessary (we could pass a NULL service). | 216 // Initialize so that this isn't necessary (we could pass a NULL service). |
217 // We currently do return it via EXPECT_CALLs, but without depending on | 217 // We currently do return it via EXPECT_CALLs, but without depending on |
218 // order-of-initialization (which seems way more fragile) we can't tell | 218 // order-of-initialization (which seems way more fragile) we can't tell |
219 // which component is asking at what time, and some components in these | 219 // which component is asking at what time, and some components in these |
220 // Autofill tests require a WebDataService. | 220 // Autofill tests require a WebDataService. |
221 return 0; | 221 return 0; |
222 } | 222 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 AutofillProfileSyncableService* autofill_profile_syncable_service_; | 336 AutofillProfileSyncableService* autofill_profile_syncable_service_; |
337 scoped_ptr<autofill::AutofillWebDataBackend> backend_; | 337 scoped_ptr<autofill::AutofillWebDataBackend> backend_; |
338 | 338 |
339 WaitableEvent syncable_service_created_or_destroyed_; | 339 WaitableEvent syncable_service_created_or_destroyed_; |
340 | 340 |
341 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake); | 341 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake); |
342 }; | 342 }; |
343 | 343 |
344 KeyedService* BuildMockWebDataServiceWrapper(content::BrowserContext* profile) { | 344 KeyedService* BuildMockWebDataServiceWrapper(content::BrowserContext* profile) { |
345 return new MockWebDataServiceWrapper( | 345 return new MockWebDataServiceWrapper( |
346 NULL, | |
347 new WebDataServiceFake(), | 346 new WebDataServiceFake(), |
348 new TokenWebDataServiceFake()); | 347 new TokenWebDataServiceFake()); |
349 } | 348 } |
350 | 349 |
351 ACTION_P(MakeAutocompleteSyncComponents, wds) { | 350 ACTION_P(MakeAutocompleteSyncComponents, wds) { |
352 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 351 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
353 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) | 352 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) |
354 return base::WeakPtr<syncer::SyncableService>(); | 353 return base::WeakPtr<syncer::SyncableService>(); |
355 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); | 354 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); |
356 } | 355 } |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 std::vector<AutofillEntry> sync_entries; | 1373 std::vector<AutofillEntry> sync_entries; |
1375 std::vector<AutofillProfile> sync_profiles; | 1374 std::vector<AutofillProfile> sync_profiles; |
1376 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1375 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
1377 EXPECT_EQ(3U, sync_entries.size()); | 1376 EXPECT_EQ(3U, sync_entries.size()); |
1378 EXPECT_EQ(0U, sync_profiles.size()); | 1377 EXPECT_EQ(0U, sync_profiles.size()); |
1379 for (size_t i = 0; i < sync_entries.size(); i++) { | 1378 for (size_t i = 0; i < sync_entries.size(); i++) { |
1380 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1379 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
1381 << ", " << sync_entries[i].key().value(); | 1380 << ", " << sync_entries[i].key().value(); |
1382 } | 1381 } |
1383 } | 1382 } |
OLD | NEW |