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 #include <wincrypt.h> | 6 #include <wincrypt.h> |
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 wds_->AddIE7Login(password_info); | 198 wds_->AddIE7Login(password_info); |
199 | 199 |
200 // The WDS schedules tasks to run on the DB thread so we schedule yet another | 200 // The WDS schedules tasks to run on the DB thread so we schedule yet another |
201 // task to notify us that it's safe to carry on with the test. | 201 // task to notify us that it's safe to carry on with the test. |
202 WaitableEvent done(false, false); | 202 WaitableEvent done(false, false); |
203 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 203 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
204 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); | 204 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); |
205 done.Wait(); | 205 done.Wait(); |
206 | 206 |
207 store_ = CreatePasswordStore(); | 207 store_ = CreatePasswordStore(); |
208 EXPECT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare(), "")); | 208 EXPECT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare())); |
209 | 209 |
210 MockPasswordStoreConsumer consumer; | 210 MockPasswordStoreConsumer consumer; |
211 | 211 |
212 // Make sure we quit the MessageLoop even if the test fails. | 212 // Make sure we quit the MessageLoop even if the test fails. |
213 ON_CALL(consumer, OnGetPasswordStoreResults(_)) | 213 ON_CALL(consumer, OnGetPasswordStoreResults(_)) |
214 .WillByDefault(QuitUIMessageLoop()); | 214 .WillByDefault(QuitUIMessageLoop()); |
215 | 215 |
216 PasswordFormData form_data = { | 216 PasswordFormData form_data = { |
217 PasswordForm::SCHEME_HTML, | 217 PasswordForm::SCHEME_HTML, |
218 "http://example.com/", | 218 "http://example.com/", |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); | 252 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); |
253 base::MessageLoop::current()->Run(); | 253 base::MessageLoop::current()->Run(); |
254 | 254 |
255 STLDeleteElements(&forms); | 255 STLDeleteElements(&forms); |
256 } | 256 } |
257 | 257 |
258 // Crashy. http://crbug.com/86558 | 258 // Crashy. http://crbug.com/86558 |
259 TEST_F(PasswordStoreWinTest, DISABLED_OutstandingWDSQueries) { | 259 TEST_F(PasswordStoreWinTest, DISABLED_OutstandingWDSQueries) { |
260 store_ = CreatePasswordStore(); | 260 store_ = CreatePasswordStore(); |
261 EXPECT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare(), "")); | 261 EXPECT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare())); |
262 | 262 |
263 PasswordFormData form_data = { | 263 PasswordFormData form_data = { |
264 PasswordForm::SCHEME_HTML, | 264 PasswordForm::SCHEME_HTML, |
265 "http://example.com/", | 265 "http://example.com/", |
266 "http://example.com/origin", | 266 "http://example.com/origin", |
267 "http://example.com/action", | 267 "http://example.com/action", |
268 L"submit_element", | 268 L"submit_element", |
269 L"username_element", | 269 L"username_element", |
270 L"password_element", | 270 L"password_element", |
271 L"", | 271 L"", |
(...skipping 22 matching lines...) Expand all Loading... |
294 wds_->AddIE7Login(password_info); | 294 wds_->AddIE7Login(password_info); |
295 | 295 |
296 // The WDS schedules tasks to run on the DB thread so we schedule yet another | 296 // The WDS schedules tasks to run on the DB thread so we schedule yet another |
297 // task to notify us that it's safe to carry on with the test. | 297 // task to notify us that it's safe to carry on with the test. |
298 WaitableEvent done(false, false); | 298 WaitableEvent done(false, false); |
299 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 299 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
300 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); | 300 base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); |
301 done.Wait(); | 301 done.Wait(); |
302 | 302 |
303 store_ = CreatePasswordStore(); | 303 store_ = CreatePasswordStore(); |
304 EXPECT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare(), "")); | 304 EXPECT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare())); |
305 | 305 |
306 MockPasswordStoreConsumer password_consumer; | 306 MockPasswordStoreConsumer password_consumer; |
307 // Make sure we quit the MessageLoop even if the test fails. | 307 // Make sure we quit the MessageLoop even if the test fails. |
308 ON_CALL(password_consumer, OnGetPasswordStoreResults(_)) | 308 ON_CALL(password_consumer, OnGetPasswordStoreResults(_)) |
309 .WillByDefault(QuitUIMessageLoop()); | 309 .WillByDefault(QuitUIMessageLoop()); |
310 | 310 |
311 PasswordFormData form_data = { | 311 PasswordFormData form_data = { |
312 PasswordForm::SCHEME_HTML, | 312 PasswordForm::SCHEME_HTML, |
313 "http://example.com/", | 313 "http://example.com/", |
314 "http://example.com/origin", | 314 "http://example.com/origin", |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 // schedules on the DB thread and once for the one we just scheduled on the UI | 356 // schedules on the DB thread and once for the one we just scheduled on the UI |
357 // thread. | 357 // thread. |
358 base::MessageLoop::current()->Run(); | 358 base::MessageLoop::current()->Run(); |
359 base::MessageLoop::current()->Run(); | 359 base::MessageLoop::current()->Run(); |
360 | 360 |
361 STLDeleteElements(&forms); | 361 STLDeleteElements(&forms); |
362 } | 362 } |
363 | 363 |
364 TEST_F(PasswordStoreWinTest, EmptyLogins) { | 364 TEST_F(PasswordStoreWinTest, EmptyLogins) { |
365 store_ = CreatePasswordStore(); | 365 store_ = CreatePasswordStore(); |
366 store_->Init(syncer::SyncableService::StartSyncFlare(), ""); | 366 store_->Init(syncer::SyncableService::StartSyncFlare()); |
367 | 367 |
368 PasswordFormData form_data = { | 368 PasswordFormData form_data = { |
369 PasswordForm::SCHEME_HTML, | 369 PasswordForm::SCHEME_HTML, |
370 "http://example.com/", | 370 "http://example.com/", |
371 "http://example.com/origin", | 371 "http://example.com/origin", |
372 "http://example.com/action", | 372 "http://example.com/action", |
373 L"submit_element", | 373 L"submit_element", |
374 L"username_element", | 374 L"username_element", |
375 L"password_element", | 375 L"password_element", |
376 L"", | 376 L"", |
(...skipping 13 matching lines...) Expand all Loading... |
390 EXPECT_CALL(consumer, | 390 EXPECT_CALL(consumer, |
391 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) | 391 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) |
392 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); | 392 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); |
393 | 393 |
394 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); | 394 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); |
395 base::MessageLoop::current()->Run(); | 395 base::MessageLoop::current()->Run(); |
396 } | 396 } |
397 | 397 |
398 TEST_F(PasswordStoreWinTest, EmptyBlacklistLogins) { | 398 TEST_F(PasswordStoreWinTest, EmptyBlacklistLogins) { |
399 store_ = CreatePasswordStore(); | 399 store_ = CreatePasswordStore(); |
400 store_->Init(syncer::SyncableService::StartSyncFlare(), ""); | 400 store_->Init(syncer::SyncableService::StartSyncFlare()); |
401 | 401 |
402 MockPasswordStoreConsumer consumer; | 402 MockPasswordStoreConsumer consumer; |
403 | 403 |
404 // Make sure we quit the MessageLoop even if the test fails. | 404 // Make sure we quit the MessageLoop even if the test fails. |
405 ON_CALL(consumer, OnGetPasswordStoreResults(_)) | 405 ON_CALL(consumer, OnGetPasswordStoreResults(_)) |
406 .WillByDefault(QuitUIMessageLoop()); | 406 .WillByDefault(QuitUIMessageLoop()); |
407 | 407 |
408 VectorOfForms expect_none; | 408 VectorOfForms expect_none; |
409 // expect that we get no results; | 409 // expect that we get no results; |
410 EXPECT_CALL( | 410 EXPECT_CALL( |
411 consumer, | 411 consumer, |
412 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) | 412 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) |
413 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); | 413 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); |
414 | 414 |
415 store_->GetBlacklistLogins(&consumer); | 415 store_->GetBlacklistLogins(&consumer); |
416 base::MessageLoop::current()->Run(); | 416 base::MessageLoop::current()->Run(); |
417 } | 417 } |
418 | 418 |
419 TEST_F(PasswordStoreWinTest, EmptyAutofillableLogins) { | 419 TEST_F(PasswordStoreWinTest, EmptyAutofillableLogins) { |
420 store_ = CreatePasswordStore(); | 420 store_ = CreatePasswordStore(); |
421 store_->Init(syncer::SyncableService::StartSyncFlare(), ""); | 421 store_->Init(syncer::SyncableService::StartSyncFlare()); |
422 | 422 |
423 MockPasswordStoreConsumer consumer; | 423 MockPasswordStoreConsumer consumer; |
424 | 424 |
425 // Make sure we quit the MessageLoop even if the test fails. | 425 // Make sure we quit the MessageLoop even if the test fails. |
426 ON_CALL(consumer, OnGetPasswordStoreResults(_)) | 426 ON_CALL(consumer, OnGetPasswordStoreResults(_)) |
427 .WillByDefault(QuitUIMessageLoop()); | 427 .WillByDefault(QuitUIMessageLoop()); |
428 | 428 |
429 VectorOfForms expect_none; | 429 VectorOfForms expect_none; |
430 // expect that we get no results; | 430 // expect that we get no results; |
431 EXPECT_CALL( | 431 EXPECT_CALL( |
432 consumer, | 432 consumer, |
433 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) | 433 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) |
434 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); | 434 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); |
435 | 435 |
436 store_->GetAutofillableLogins(&consumer); | 436 store_->GetAutofillableLogins(&consumer); |
437 base::MessageLoop::current()->Run(); | 437 base::MessageLoop::current()->Run(); |
438 } | 438 } |
OLD | NEW |