OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 }; | 251 }; |
252 ScopedVector<autofill::PasswordForm> expected_forms; | 252 ScopedVector<autofill::PasswordForm> expected_forms; |
253 expected_forms.push_back( | 253 expected_forms.push_back( |
254 CreatePasswordFormFromDataForTesting(expected_form_data)); | 254 CreatePasswordFormFromDataForTesting(expected_form_data)); |
255 | 255 |
256 // The IE7 password should be returned. | 256 // The IE7 password should be returned. |
257 EXPECT_CALL(consumer, | 257 EXPECT_CALL(consumer, |
258 OnGetPasswordStoreResultsConstRef( | 258 OnGetPasswordStoreResultsConstRef( |
259 UnorderedPasswordFormElementsAre(expected_forms.get()))); | 259 UnorderedPasswordFormElementsAre(expected_forms.get()))); |
260 | 260 |
261 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); | 261 store_->GetLogins(*form, &consumer); |
262 base::MessageLoop::current()->Run(); | 262 base::MessageLoop::current()->Run(); |
263 } | 263 } |
264 | 264 |
265 // Crashy. http://crbug.com/86558 | 265 // Crashy. http://crbug.com/86558 |
266 TEST_F(PasswordStoreWinTest, DISABLED_OutstandingWDSQueries) { | 266 TEST_F(PasswordStoreWinTest, DISABLED_OutstandingWDSQueries) { |
267 store_ = CreatePasswordStore(); | 267 store_ = CreatePasswordStore(); |
268 EXPECT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare())); | 268 EXPECT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare())); |
269 | 269 |
270 PasswordFormData form_data = { | 270 PasswordFormData form_data = { |
271 PasswordForm::SCHEME_HTML, | 271 PasswordForm::SCHEME_HTML, |
272 "http://example.com/", | 272 "http://example.com/", |
273 "http://example.com/origin", | 273 "http://example.com/origin", |
274 "http://example.com/action", | 274 "http://example.com/action", |
275 L"submit_element", | 275 L"submit_element", |
276 L"username_element", | 276 L"username_element", |
277 L"password_element", | 277 L"password_element", |
278 L"", | 278 L"", |
279 L"", | 279 L"", |
280 true, false, 1, | 280 true, false, 1, |
281 }; | 281 }; |
282 scoped_ptr<PasswordForm> form = | 282 scoped_ptr<PasswordForm> form = |
283 CreatePasswordFormFromDataForTesting(form_data); | 283 CreatePasswordFormFromDataForTesting(form_data); |
284 | 284 |
285 MockPasswordStoreConsumer consumer; | 285 MockPasswordStoreConsumer consumer; |
286 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); | 286 store_->GetLogins(*form, &consumer); |
287 | 287 |
288 // Release the PSW and the WDS before the query can return. | 288 // Release the PSW and the WDS before the query can return. |
289 store_->ShutdownOnUIThread(); | 289 store_->ShutdownOnUIThread(); |
290 store_ = nullptr; | 290 store_ = nullptr; |
291 wds_ = nullptr; | 291 wds_ = nullptr; |
292 | 292 |
293 base::MessageLoop::current()->RunUntilIdle(); | 293 base::MessageLoop::current()->RunUntilIdle(); |
294 } | 294 } |
295 | 295 |
296 // Hangs flakily, see http://crbug.com/43836. | 296 // Hangs flakily, see http://crbug.com/43836. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 }; | 345 }; |
346 ScopedVector<autofill::PasswordForm> expected_forms; | 346 ScopedVector<autofill::PasswordForm> expected_forms; |
347 expected_forms.push_back( | 347 expected_forms.push_back( |
348 CreatePasswordFormFromDataForTesting(expected_form_data)); | 348 CreatePasswordFormFromDataForTesting(expected_form_data)); |
349 | 349 |
350 // The IE7 password should be returned. | 350 // The IE7 password should be returned. |
351 EXPECT_CALL(password_consumer, | 351 EXPECT_CALL(password_consumer, |
352 OnGetPasswordStoreResultsConstRef( | 352 OnGetPasswordStoreResultsConstRef( |
353 UnorderedPasswordFormElementsAre(expected_forms.get()))); | 353 UnorderedPasswordFormElementsAre(expected_forms.get()))); |
354 | 354 |
355 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &password_consumer); | 355 store_->GetLogins(*form, &password_consumer); |
356 | 356 |
357 MockWebDataServiceConsumer wds_consumer; | 357 MockWebDataServiceConsumer wds_consumer; |
358 | 358 |
359 EXPECT_CALL(wds_consumer, OnWebDataServiceRequestDone(_, _)) | 359 EXPECT_CALL(wds_consumer, OnWebDataServiceRequestDone(_, _)) |
360 .WillOnce(QuitUIMessageLoop()); | 360 .WillOnce(QuitUIMessageLoop()); |
361 | 361 |
362 wds_->GetIE7Login(password_info, &wds_consumer); | 362 wds_->GetIE7Login(password_info, &wds_consumer); |
363 | 363 |
364 // Run the MessageLoop twice: once for the GetIE7Login that PasswordStoreWin | 364 // Run the MessageLoop twice: once for the GetIE7Login that PasswordStoreWin |
365 // schedules on the DB thread and once for the one we just scheduled on the UI | 365 // schedules on the DB thread and once for the one we just scheduled on the UI |
(...skipping 22 matching lines...) Expand all Loading... |
388 CreatePasswordFormFromDataForTesting(form_data); | 388 CreatePasswordFormFromDataForTesting(form_data); |
389 | 389 |
390 MockPasswordStoreConsumer consumer; | 390 MockPasswordStoreConsumer consumer; |
391 | 391 |
392 // Make sure we quit the MessageLoop even if the test fails. | 392 // Make sure we quit the MessageLoop even if the test fails. |
393 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) | 393 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) |
394 .WillByDefault(QuitUIMessageLoop()); | 394 .WillByDefault(QuitUIMessageLoop()); |
395 | 395 |
396 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); | 396 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); |
397 | 397 |
398 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); | 398 store_->GetLogins(*form, &consumer); |
399 base::MessageLoop::current()->Run(); | 399 base::MessageLoop::current()->Run(); |
400 } | 400 } |
401 | 401 |
402 TEST_F(PasswordStoreWinTest, EmptyBlacklistLogins) { | 402 TEST_F(PasswordStoreWinTest, EmptyBlacklistLogins) { |
403 store_ = CreatePasswordStore(); | 403 store_ = CreatePasswordStore(); |
404 store_->Init(syncer::SyncableService::StartSyncFlare()); | 404 store_->Init(syncer::SyncableService::StartSyncFlare()); |
405 | 405 |
406 MockPasswordStoreConsumer consumer; | 406 MockPasswordStoreConsumer consumer; |
407 | 407 |
408 // Make sure we quit the MessageLoop even if the test fails. | 408 // Make sure we quit the MessageLoop even if the test fails. |
(...skipping 14 matching lines...) Expand all Loading... |
423 | 423 |
424 // Make sure we quit the MessageLoop even if the test fails. | 424 // Make sure we quit the MessageLoop even if the test fails. |
425 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) | 425 ON_CALL(consumer, OnGetPasswordStoreResultsConstRef(_)) |
426 .WillByDefault(QuitUIMessageLoop()); | 426 .WillByDefault(QuitUIMessageLoop()); |
427 | 427 |
428 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); | 428 EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); |
429 | 429 |
430 store_->GetAutofillableLogins(&consumer); | 430 store_->GetAutofillableLogins(&consumer); |
431 base::MessageLoop::current()->Run(); | 431 base::MessageLoop::current()->Run(); |
432 } | 432 } |
OLD | NEW |