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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 true, false, 1, | 229 true, false, 1, |
230 }; | 230 }; |
231 std::vector<PasswordForm*> forms; | 231 std::vector<PasswordForm*> forms; |
232 forms.push_back(CreatePasswordFormFromData(expected_form_data)); | 232 forms.push_back(CreatePasswordFormFromData(expected_form_data)); |
233 | 233 |
234 // The IE7 password should be returned. | 234 // The IE7 password should be returned. |
235 EXPECT_CALL(consumer, | 235 EXPECT_CALL(consumer, |
236 OnGetPasswordStoreResults(ContainsAllPasswordForms(forms))) | 236 OnGetPasswordStoreResults(ContainsAllPasswordForms(forms))) |
237 .WillOnce(QuitUIMessageLoop()); | 237 .WillOnce(QuitUIMessageLoop()); |
238 | 238 |
239 store_->GetLogins(*form, &consumer); | 239 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); |
240 base::MessageLoop::current()->Run(); | 240 base::MessageLoop::current()->Run(); |
241 | 241 |
242 STLDeleteElements(&forms); | 242 STLDeleteElements(&forms); |
243 } | 243 } |
244 | 244 |
245 // Crashy. http://crbug.com/86558 | 245 // Crashy. http://crbug.com/86558 |
246 TEST_F(PasswordStoreWinTest, DISABLED_OutstandingWDSQueries) { | 246 TEST_F(PasswordStoreWinTest, DISABLED_OutstandingWDSQueries) { |
247 store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), | 247 store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), |
248 wds_.get()); | 248 wds_.get()); |
249 EXPECT_TRUE(store_->Init()); | 249 EXPECT_TRUE(store_->Init()); |
250 | 250 |
251 PasswordFormData form_data = { | 251 PasswordFormData form_data = { |
252 PasswordForm::SCHEME_HTML, | 252 PasswordForm::SCHEME_HTML, |
253 "http://example.com/", | 253 "http://example.com/", |
254 "http://example.com/origin", | 254 "http://example.com/origin", |
255 "http://example.com/action", | 255 "http://example.com/action", |
256 L"submit_element", | 256 L"submit_element", |
257 L"username_element", | 257 L"username_element", |
258 L"password_element", | 258 L"password_element", |
259 L"", | 259 L"", |
260 L"", | 260 L"", |
261 true, false, 1, | 261 true, false, 1, |
262 }; | 262 }; |
263 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); | 263 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); |
264 | 264 |
265 MockPasswordStoreConsumer consumer; | 265 MockPasswordStoreConsumer consumer; |
266 store_->GetLogins(*form, &consumer); | 266 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); |
267 | 267 |
268 // Release the PSW and the WDS before the query can return. | 268 // Release the PSW and the WDS before the query can return. |
269 store_->ShutdownOnUIThread(); | 269 store_->ShutdownOnUIThread(); |
270 store_ = NULL; | 270 store_ = NULL; |
271 wds_ = NULL; | 271 wds_ = NULL; |
272 | 272 |
273 base::MessageLoop::current()->RunUntilIdle(); | 273 base::MessageLoop::current()->RunUntilIdle(); |
274 } | 274 } |
275 | 275 |
276 // Hangs flakily, see http://crbug.com/43836. | 276 // Hangs flakily, see http://crbug.com/43836. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 true, false, 1, | 324 true, false, 1, |
325 }; | 325 }; |
326 std::vector<PasswordForm*> forms; | 326 std::vector<PasswordForm*> forms; |
327 forms.push_back(CreatePasswordFormFromData(expected_form_data)); | 327 forms.push_back(CreatePasswordFormFromData(expected_form_data)); |
328 | 328 |
329 // The IE7 password should be returned. | 329 // The IE7 password should be returned. |
330 EXPECT_CALL(password_consumer, | 330 EXPECT_CALL(password_consumer, |
331 OnGetPasswordStoreResults(ContainsAllPasswordForms(forms))) | 331 OnGetPasswordStoreResults(ContainsAllPasswordForms(forms))) |
332 .WillOnce(QuitUIMessageLoop()); | 332 .WillOnce(QuitUIMessageLoop()); |
333 | 333 |
334 store_->GetLogins(*form, &password_consumer); | 334 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &password_consumer); |
335 | 335 |
336 MockWebDataServiceConsumer wds_consumer; | 336 MockWebDataServiceConsumer wds_consumer; |
337 | 337 |
338 EXPECT_CALL(wds_consumer, | 338 EXPECT_CALL(wds_consumer, |
339 OnWebDataServiceRequestDone(_, _)) | 339 OnWebDataServiceRequestDone(_, _)) |
340 .WillOnce(QuitUIMessageLoop()); | 340 .WillOnce(QuitUIMessageLoop()); |
341 | 341 |
342 wds_->GetIE7Login(password_info, &wds_consumer); | 342 wds_->GetIE7Login(password_info, &wds_consumer); |
343 | 343 |
344 // Run the MessageLoop twice: once for the GetIE7Login that PasswordStoreWin | 344 // Run the MessageLoop twice: once for the GetIE7Login that PasswordStoreWin |
(...skipping 29 matching lines...) Expand all Loading... |
374 // Make sure we quit the MessageLoop even if the test fails. | 374 // Make sure we quit the MessageLoop even if the test fails. |
375 ON_CALL(consumer, OnGetPasswordStoreResults(_)) | 375 ON_CALL(consumer, OnGetPasswordStoreResults(_)) |
376 .WillByDefault(QuitUIMessageLoop()); | 376 .WillByDefault(QuitUIMessageLoop()); |
377 | 377 |
378 VectorOfForms expect_none; | 378 VectorOfForms expect_none; |
379 // expect that we get no results; | 379 // expect that we get no results; |
380 EXPECT_CALL(consumer, | 380 EXPECT_CALL(consumer, |
381 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) | 381 OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) |
382 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); | 382 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); |
383 | 383 |
384 store_->GetLogins(*form, &consumer); | 384 store_->GetLogins(*form, PasswordStore::DISALLOW_PROMPT, &consumer); |
385 base::MessageLoop::current()->Run(); | 385 base::MessageLoop::current()->Run(); |
386 } | 386 } |
387 | 387 |
388 TEST_F(PasswordStoreWinTest, EmptyBlacklistLogins) { | 388 TEST_F(PasswordStoreWinTest, EmptyBlacklistLogins) { |
389 store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), | 389 store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), |
390 wds_.get()); | 390 wds_.get()); |
391 store_->Init(); | 391 store_->Init(); |
392 | 392 |
393 MockPasswordStoreConsumer consumer; | 393 MockPasswordStoreConsumer consumer; |
394 | 394 |
(...skipping 26 matching lines...) Expand all Loading... |
421 VectorOfForms expect_none; | 421 VectorOfForms expect_none; |
422 // expect that we get no results; | 422 // expect that we get no results; |
423 EXPECT_CALL( | 423 EXPECT_CALL( |
424 consumer, | 424 consumer, |
425 OnPasswordStoreRequestDone(_, ContainsAllPasswordForms(expect_none))) | 425 OnPasswordStoreRequestDone(_, ContainsAllPasswordForms(expect_none))) |
426 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); | 426 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); |
427 | 427 |
428 store_->GetAutofillableLogins(&consumer); | 428 store_->GetAutofillableLogins(&consumer); |
429 base::MessageLoop::current()->Run(); | 429 base::MessageLoop::current()->Run(); |
430 } | 430 } |
OLD | NEW |