| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdarg.h> | 5 #include <stdarg.h> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 }; | 388 }; |
| 389 | 389 |
| 390 TEST_F(NativeBackendGnomeTest, BasicAddLogin) { | 390 TEST_F(NativeBackendGnomeTest, BasicAddLogin) { |
| 391 // Pretend that the migration has already taken place. | 391 // Pretend that the migration has already taken place. |
| 392 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); | 392 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); |
| 393 | 393 |
| 394 NativeBackendGnome backend(42, profile_.GetPrefs()); | 394 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 395 backend.Init(); | 395 backend.Init(); |
| 396 | 396 |
| 397 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 397 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 398 base::IgnoreReturn(base::Callback<bool(void)>( | 398 base::IgnoreReturn<bool>(base::Bind( |
| 399 base::Bind(&NativeBackendGnome::AddLogin, | 399 &NativeBackendGnome::AddLogin, |
| 400 base::Unretained(&backend), form_google_)))); | 400 base::Unretained(&backend), form_google_))); |
| 401 | 401 |
| 402 RunBothThreads(); | 402 RunBothThreads(); |
| 403 | 403 |
| 404 EXPECT_EQ(1u, mock_keyring_items.size()); | 404 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 405 if (mock_keyring_items.size() > 0) | 405 if (mock_keyring_items.size() > 0) |
| 406 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 406 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 407 } | 407 } |
| 408 | 408 |
| 409 TEST_F(NativeBackendGnomeTest, BasicListLogins) { | 409 TEST_F(NativeBackendGnomeTest, BasicListLogins) { |
| 410 // Pretend that the migration has already taken place. | 410 // Pretend that the migration has already taken place. |
| 411 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); | 411 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); |
| 412 | 412 |
| 413 NativeBackendGnome backend(42, profile_.GetPrefs()); | 413 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 414 backend.Init(); | 414 backend.Init(); |
| 415 | 415 |
| 416 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 416 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 417 base::IgnoreReturn(base::Callback<bool(void)>( | 417 base::IgnoreReturn<bool>(base::Bind( |
| 418 base::Bind(&NativeBackendGnome::AddLogin, | 418 &NativeBackendGnome::AddLogin, |
| 419 base::Unretained(&backend), form_google_)))); | 419 base::Unretained(&backend), form_google_))); |
| 420 | 420 |
| 421 std::vector<PasswordForm*> form_list; | 421 std::vector<PasswordForm*> form_list; |
| 422 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 422 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 423 base::IgnoreReturn(base::Callback<bool(void)>( | 423 base::IgnoreReturn<bool>(base::Bind( |
| 424 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 424 &NativeBackendGnome::GetAutofillableLogins, |
| 425 base::Unretained(&backend), &form_list)))); | 425 base::Unretained(&backend), &form_list))); |
| 426 | 426 |
| 427 RunBothThreads(); | 427 RunBothThreads(); |
| 428 | 428 |
| 429 // Quick check that we got something back. | 429 // Quick check that we got something back. |
| 430 EXPECT_EQ(1u, form_list.size()); | 430 EXPECT_EQ(1u, form_list.size()); |
| 431 STLDeleteElements(&form_list); | 431 STLDeleteElements(&form_list); |
| 432 | 432 |
| 433 EXPECT_EQ(1u, mock_keyring_items.size()); | 433 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 434 if (mock_keyring_items.size() > 0) | 434 if (mock_keyring_items.size() > 0) |
| 435 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 435 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 436 } | 436 } |
| 437 | 437 |
| 438 TEST_F(NativeBackendGnomeTest, BasicRemoveLogin) { | 438 TEST_F(NativeBackendGnomeTest, BasicRemoveLogin) { |
| 439 // Pretend that the migration has already taken place. | 439 // Pretend that the migration has already taken place. |
| 440 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); | 440 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); |
| 441 | 441 |
| 442 NativeBackendGnome backend(42, profile_.GetPrefs()); | 442 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 443 backend.Init(); | 443 backend.Init(); |
| 444 | 444 |
| 445 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 445 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 446 base::IgnoreReturn(base::Callback<bool(void)>( | 446 base::IgnoreReturn<bool>(base::Bind( |
| 447 base::Bind(&NativeBackendGnome::AddLogin, | 447 &NativeBackendGnome::AddLogin, |
| 448 base::Unretained(&backend), form_google_)))); | 448 base::Unretained(&backend), form_google_))); |
| 449 | 449 |
| 450 RunBothThreads(); | 450 RunBothThreads(); |
| 451 | 451 |
| 452 EXPECT_EQ(1u, mock_keyring_items.size()); | 452 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 453 if (mock_keyring_items.size() > 0) | 453 if (mock_keyring_items.size() > 0) |
| 454 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 454 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 455 | 455 |
| 456 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 456 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 457 base::IgnoreReturn(base::Callback<bool(void)>( | 457 base::IgnoreReturn<bool>(base::Bind( |
| 458 base::Bind(&NativeBackendGnome::RemoveLogin, | 458 &NativeBackendGnome::RemoveLogin, |
| 459 base::Unretained(&backend), form_google_)))); | 459 base::Unretained(&backend), form_google_))); |
| 460 | 460 |
| 461 RunBothThreads(); | 461 RunBothThreads(); |
| 462 | 462 |
| 463 EXPECT_EQ(0u, mock_keyring_items.size()); | 463 EXPECT_EQ(0u, mock_keyring_items.size()); |
| 464 } | 464 } |
| 465 | 465 |
| 466 TEST_F(NativeBackendGnomeTest, RemoveNonexistentLogin) { | 466 TEST_F(NativeBackendGnomeTest, RemoveNonexistentLogin) { |
| 467 // Pretend that the migration has already taken place. | 467 // Pretend that the migration has already taken place. |
| 468 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); | 468 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); |
| 469 | 469 |
| 470 NativeBackendGnome backend(42, profile_.GetPrefs()); | 470 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 471 backend.Init(); | 471 backend.Init(); |
| 472 | 472 |
| 473 // First add an unrelated login. | 473 // First add an unrelated login. |
| 474 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 474 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 475 base::IgnoreReturn(base::Callback<bool(void)>( | 475 base::IgnoreReturn<bool>(base::Bind( |
| 476 base::Bind(&NativeBackendGnome::AddLogin, | 476 &NativeBackendGnome::AddLogin, |
| 477 base::Unretained(&backend), form_google_)))); | 477 base::Unretained(&backend), form_google_))); |
| 478 | 478 |
| 479 RunBothThreads(); | 479 RunBothThreads(); |
| 480 | 480 |
| 481 EXPECT_EQ(1u, mock_keyring_items.size()); | 481 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 482 if (mock_keyring_items.size() > 0) | 482 if (mock_keyring_items.size() > 0) |
| 483 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 483 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 484 | 484 |
| 485 // Attempt to remove a login that doesn't exist. | 485 // Attempt to remove a login that doesn't exist. |
| 486 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 486 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 487 base::IgnoreReturn(base::Callback<bool(void)>( | 487 base::IgnoreReturn<bool>(base::Bind( |
| 488 base::Bind(&NativeBackendGnome::RemoveLogin, | 488 &NativeBackendGnome::RemoveLogin, |
| 489 base::Unretained(&backend), form_isc_)))); | 489 base::Unretained(&backend), form_isc_))); |
| 490 | 490 |
| 491 // Make sure we can still get the first form back. | 491 // Make sure we can still get the first form back. |
| 492 std::vector<PasswordForm*> form_list; | 492 std::vector<PasswordForm*> form_list; |
| 493 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 493 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 494 base::IgnoreReturn(base::Callback<bool(void)>( | 494 base::IgnoreReturn<bool>(base::Bind( |
| 495 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 495 &NativeBackendGnome::GetAutofillableLogins, |
| 496 base::Unretained(&backend), &form_list)))); | 496 base::Unretained(&backend), &form_list))); |
| 497 | 497 |
| 498 RunBothThreads(); | 498 RunBothThreads(); |
| 499 | 499 |
| 500 // Quick check that we got something back. | 500 // Quick check that we got something back. |
| 501 EXPECT_EQ(1u, form_list.size()); | 501 EXPECT_EQ(1u, form_list.size()); |
| 502 STLDeleteElements(&form_list); | 502 STLDeleteElements(&form_list); |
| 503 | 503 |
| 504 EXPECT_EQ(1u, mock_keyring_items.size()); | 504 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 505 if (mock_keyring_items.size() > 0) | 505 if (mock_keyring_items.size() > 0) |
| 506 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 506 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 507 } | 507 } |
| 508 | 508 |
| 509 TEST_F(NativeBackendGnomeTest, AddDuplicateLogin) { | 509 TEST_F(NativeBackendGnomeTest, AddDuplicateLogin) { |
| 510 // Pretend that the migration has already taken place. | 510 // Pretend that the migration has already taken place. |
| 511 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); | 511 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); |
| 512 | 512 |
| 513 NativeBackendGnome backend(42, profile_.GetPrefs()); | 513 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 514 backend.Init(); | 514 backend.Init(); |
| 515 | 515 |
| 516 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 516 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 517 base::IgnoreReturn(base::Callback<bool(void)>( | 517 base::IgnoreReturn<bool>(base::Bind( |
| 518 base::Bind(&NativeBackendGnome::AddLogin, | 518 &NativeBackendGnome::AddLogin, |
| 519 base::Unretained(&backend), form_google_)))); | 519 base::Unretained(&backend), form_google_))); |
| 520 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 520 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 521 base::IgnoreReturn(base::Callback<bool(void)>( | 521 base::IgnoreReturn<bool>(base::Bind( |
| 522 base::Bind(&NativeBackendGnome::AddLogin, | 522 &NativeBackendGnome::AddLogin, |
| 523 base::Unretained(&backend), form_google_)))); | 523 base::Unretained(&backend), form_google_))); |
| 524 | 524 |
| 525 RunBothThreads(); | 525 RunBothThreads(); |
| 526 | 526 |
| 527 EXPECT_EQ(1u, mock_keyring_items.size()); | 527 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 528 if (mock_keyring_items.size() > 0) | 528 if (mock_keyring_items.size() > 0) |
| 529 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 529 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 530 } | 530 } |
| 531 | 531 |
| 532 TEST_F(NativeBackendGnomeTest, ListLoginsAppends) { | 532 TEST_F(NativeBackendGnomeTest, ListLoginsAppends) { |
| 533 // Pretend that the migration has already taken place. | 533 // Pretend that the migration has already taken place. |
| 534 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); | 534 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); |
| 535 | 535 |
| 536 NativeBackendGnome backend(42, profile_.GetPrefs()); | 536 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 537 backend.Init(); | 537 backend.Init(); |
| 538 | 538 |
| 539 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 539 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 540 base::IgnoreReturn(base::Callback<bool(void)>( | 540 base::IgnoreReturn<bool>(base::Bind( |
| 541 base::Bind(&NativeBackendGnome::AddLogin, | 541 &NativeBackendGnome::AddLogin, |
| 542 base::Unretained(&backend), form_google_)))); | 542 base::Unretained(&backend), form_google_))); |
| 543 | 543 |
| 544 // Send the same request twice with the same list both times. | 544 // Send the same request twice with the same list both times. |
| 545 std::vector<PasswordForm*> form_list; | 545 std::vector<PasswordForm*> form_list; |
| 546 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 546 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 547 base::IgnoreReturn(base::Callback<bool(void)>( | 547 base::IgnoreReturn<bool>(base::Bind( |
| 548 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 548 &NativeBackendGnome::GetAutofillableLogins, |
| 549 base::Unretained(&backend), &form_list)))); | 549 base::Unretained(&backend), &form_list))); |
| 550 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 550 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 551 base::IgnoreReturn(base::Callback<bool(void)>( | 551 base::IgnoreReturn<bool>(base::Bind( |
| 552 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 552 &NativeBackendGnome::GetAutofillableLogins, |
| 553 base::Unretained(&backend), &form_list)))); | 553 base::Unretained(&backend), &form_list))); |
| 554 | 554 |
| 555 RunBothThreads(); | 555 RunBothThreads(); |
| 556 | 556 |
| 557 // Quick check that we got two results back. | 557 // Quick check that we got two results back. |
| 558 EXPECT_EQ(2u, form_list.size()); | 558 EXPECT_EQ(2u, form_list.size()); |
| 559 STLDeleteElements(&form_list); | 559 STLDeleteElements(&form_list); |
| 560 | 560 |
| 561 EXPECT_EQ(1u, mock_keyring_items.size()); | 561 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 562 if (mock_keyring_items.size() > 0) | 562 if (mock_keyring_items.size() > 0) |
| 563 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 563 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 564 } | 564 } |
| 565 | 565 |
| 566 // TODO(mdm): add more basic (i.e. non-migration) tests here at some point. | 566 // TODO(mdm): add more basic (i.e. non-migration) tests here at some point. |
| 567 | 567 |
| 568 TEST_F(NativeBackendGnomeTest, MigrateOneLogin) { | 568 TEST_F(NativeBackendGnomeTest, MigrateOneLogin) { |
| 569 // Reject attempts to migrate so we can populate the store. | 569 // Reject attempts to migrate so we can populate the store. |
| 570 mock_keyring_reject_local_ids = true; | 570 mock_keyring_reject_local_ids = true; |
| 571 | 571 |
| 572 { | 572 { |
| 573 NativeBackendGnome backend(42, profile_.GetPrefs()); | 573 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 574 backend.Init(); | 574 backend.Init(); |
| 575 | 575 |
| 576 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 576 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 577 base::IgnoreReturn(base::Callback<bool(void)>( | 577 base::IgnoreReturn<bool>(base::Bind( |
| 578 base::Bind(&NativeBackendGnome::AddLogin, | 578 &NativeBackendGnome::AddLogin, |
| 579 base::Unretained(&backend), form_google_)))); | 579 base::Unretained(&backend), form_google_))); |
| 580 | 580 |
| 581 // Make sure we can get the form back even when migration is failing. | 581 // Make sure we can get the form back even when migration is failing. |
| 582 std::vector<PasswordForm*> form_list; | 582 std::vector<PasswordForm*> form_list; |
| 583 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 583 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 584 base::IgnoreReturn(base::Callback<bool(void)>( | 584 base::IgnoreReturn<bool>(base::Bind( |
| 585 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 585 &NativeBackendGnome::GetAutofillableLogins, |
| 586 base::Unretained(&backend), &form_list)))); | 586 base::Unretained(&backend), &form_list))); |
| 587 | 587 |
| 588 RunBothThreads(); | 588 RunBothThreads(); |
| 589 | 589 |
| 590 // Quick check that we got something back. | 590 // Quick check that we got something back. |
| 591 EXPECT_EQ(1u, form_list.size()); | 591 EXPECT_EQ(1u, form_list.size()); |
| 592 STLDeleteElements(&form_list); | 592 STLDeleteElements(&form_list); |
| 593 } | 593 } |
| 594 | 594 |
| 595 EXPECT_EQ(1u, mock_keyring_items.size()); | 595 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 596 if (mock_keyring_items.size() > 0) | 596 if (mock_keyring_items.size() > 0) |
| 597 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 597 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 598 | 598 |
| 599 // Now allow the migration. | 599 // Now allow the migration. |
| 600 mock_keyring_reject_local_ids = false; | 600 mock_keyring_reject_local_ids = false; |
| 601 | 601 |
| 602 { | 602 { |
| 603 NativeBackendGnome backend(42, profile_.GetPrefs()); | 603 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 604 backend.Init(); | 604 backend.Init(); |
| 605 | 605 |
| 606 // This should not trigger migration because there will be no results. | 606 // This should not trigger migration because there will be no results. |
| 607 std::vector<PasswordForm*> form_list; | 607 std::vector<PasswordForm*> form_list; |
| 608 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 608 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 609 base::IgnoreReturn(base::Callback<bool(void)>( | 609 base::IgnoreReturn<bool>(base::Bind( |
| 610 base::Bind(&NativeBackendGnome::GetBlacklistLogins, | 610 &NativeBackendGnome::GetBlacklistLogins, |
| 611 base::Unretained(&backend), &form_list)))); | 611 base::Unretained(&backend), &form_list))); |
| 612 | 612 |
| 613 RunBothThreads(); | 613 RunBothThreads(); |
| 614 | 614 |
| 615 // Check that we got nothing back. | 615 // Check that we got nothing back. |
| 616 EXPECT_EQ(0u, form_list.size()); | 616 EXPECT_EQ(0u, form_list.size()); |
| 617 STLDeleteElements(&form_list); | 617 STLDeleteElements(&form_list); |
| 618 } | 618 } |
| 619 | 619 |
| 620 // Check that the keyring is unmodified. | 620 // Check that the keyring is unmodified. |
| 621 EXPECT_EQ(1u, mock_keyring_items.size()); | 621 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 622 if (mock_keyring_items.size() > 0) | 622 if (mock_keyring_items.size() > 0) |
| 623 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 623 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 624 | 624 |
| 625 // Check that we haven't set the persistent preference. | 625 // Check that we haven't set the persistent preference. |
| 626 EXPECT_FALSE( | 626 EXPECT_FALSE( |
| 627 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); | 627 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); |
| 628 | 628 |
| 629 { | 629 { |
| 630 NativeBackendGnome backend(42, profile_.GetPrefs()); | 630 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 631 backend.Init(); | 631 backend.Init(); |
| 632 | 632 |
| 633 // Trigger the migration by looking something up. | 633 // Trigger the migration by looking something up. |
| 634 std::vector<PasswordForm*> form_list; | 634 std::vector<PasswordForm*> form_list; |
| 635 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 635 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 636 base::IgnoreReturn(base::Callback<bool(void)>( | 636 base::IgnoreReturn<bool>(base::Bind( |
| 637 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 637 &NativeBackendGnome::GetAutofillableLogins, |
| 638 base::Unretained(&backend), &form_list)))); | 638 base::Unretained(&backend), &form_list))); |
| 639 | 639 |
| 640 RunBothThreads(); | 640 RunBothThreads(); |
| 641 | 641 |
| 642 // Quick check that we got something back. | 642 // Quick check that we got something back. |
| 643 EXPECT_EQ(1u, form_list.size()); | 643 EXPECT_EQ(1u, form_list.size()); |
| 644 STLDeleteElements(&form_list); | 644 STLDeleteElements(&form_list); |
| 645 } | 645 } |
| 646 | 646 |
| 647 EXPECT_EQ(2u, mock_keyring_items.size()); | 647 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 648 if (mock_keyring_items.size() > 0) | 648 if (mock_keyring_items.size() > 0) |
| 649 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 649 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 650 if (mock_keyring_items.size() > 1) | 650 if (mock_keyring_items.size() > 1) |
| 651 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 651 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 652 | 652 |
| 653 // Check that we have set the persistent preference. | 653 // Check that we have set the persistent preference. |
| 654 EXPECT_TRUE( | 654 EXPECT_TRUE( |
| 655 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); | 655 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); |
| 656 } | 656 } |
| 657 | 657 |
| 658 TEST_F(NativeBackendGnomeTest, MigrateToMultipleProfiles) { | 658 TEST_F(NativeBackendGnomeTest, MigrateToMultipleProfiles) { |
| 659 // Reject attempts to migrate so we can populate the store. | 659 // Reject attempts to migrate so we can populate the store. |
| 660 mock_keyring_reject_local_ids = true; | 660 mock_keyring_reject_local_ids = true; |
| 661 | 661 |
| 662 { | 662 { |
| 663 NativeBackendGnome backend(42, profile_.GetPrefs()); | 663 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 664 backend.Init(); | 664 backend.Init(); |
| 665 | 665 |
| 666 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 666 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 667 base::IgnoreReturn(base::Callback<bool(void)>( | 667 base::IgnoreReturn<bool>(base::Bind( |
| 668 base::Bind(&NativeBackendGnome::AddLogin, | 668 &NativeBackendGnome::AddLogin, |
| 669 base::Unretained(&backend), form_google_)))); | 669 base::Unretained(&backend), form_google_))); |
| 670 | 670 |
| 671 RunBothThreads(); | 671 RunBothThreads(); |
| 672 } | 672 } |
| 673 | 673 |
| 674 EXPECT_EQ(1u, mock_keyring_items.size()); | 674 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 675 if (mock_keyring_items.size() > 0) | 675 if (mock_keyring_items.size() > 0) |
| 676 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 676 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 677 | 677 |
| 678 // Now allow the migration. | 678 // Now allow the migration. |
| 679 mock_keyring_reject_local_ids = false; | 679 mock_keyring_reject_local_ids = false; |
| 680 | 680 |
| 681 { | 681 { |
| 682 NativeBackendGnome backend(42, profile_.GetPrefs()); | 682 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 683 backend.Init(); | 683 backend.Init(); |
| 684 | 684 |
| 685 // Trigger the migration by looking something up. | 685 // Trigger the migration by looking something up. |
| 686 std::vector<PasswordForm*> form_list; | 686 std::vector<PasswordForm*> form_list; |
| 687 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 687 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 688 base::IgnoreReturn(base::Callback<bool(void)>( | 688 base::IgnoreReturn<bool>(base::Bind( |
| 689 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 689 &NativeBackendGnome::GetAutofillableLogins, |
| 690 base::Unretained(&backend), &form_list)))); | 690 base::Unretained(&backend), &form_list))); |
| 691 | 691 |
| 692 RunBothThreads(); | 692 RunBothThreads(); |
| 693 | 693 |
| 694 // Quick check that we got something back. | 694 // Quick check that we got something back. |
| 695 EXPECT_EQ(1u, form_list.size()); | 695 EXPECT_EQ(1u, form_list.size()); |
| 696 STLDeleteElements(&form_list); | 696 STLDeleteElements(&form_list); |
| 697 } | 697 } |
| 698 | 698 |
| 699 EXPECT_EQ(2u, mock_keyring_items.size()); | 699 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 700 if (mock_keyring_items.size() > 0) | 700 if (mock_keyring_items.size() > 0) |
| 701 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 701 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 702 if (mock_keyring_items.size() > 1) | 702 if (mock_keyring_items.size() > 1) |
| 703 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 703 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 704 | 704 |
| 705 // Check that we have set the persistent preference. | 705 // Check that we have set the persistent preference. |
| 706 EXPECT_TRUE( | 706 EXPECT_TRUE( |
| 707 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); | 707 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); |
| 708 | 708 |
| 709 // Normally we'd actually have a different profile. But in the test just reset | 709 // Normally we'd actually have a different profile. But in the test just reset |
| 710 // the profile's persistent pref; we pass in the local profile id anyway. | 710 // the profile's persistent pref; we pass in the local profile id anyway. |
| 711 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, false); | 711 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, false); |
| 712 | 712 |
| 713 { | 713 { |
| 714 NativeBackendGnome backend(24, profile_.GetPrefs()); | 714 NativeBackendGnome backend(24, profile_.GetPrefs()); |
| 715 backend.Init(); | 715 backend.Init(); |
| 716 | 716 |
| 717 // Trigger the migration by looking something up. | 717 // Trigger the migration by looking something up. |
| 718 std::vector<PasswordForm*> form_list; | 718 std::vector<PasswordForm*> form_list; |
| 719 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 719 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 720 base::IgnoreReturn(base::Callback<bool(void)>( | 720 base::IgnoreReturn<bool>(base::Bind( |
| 721 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 721 &NativeBackendGnome::GetAutofillableLogins, |
| 722 base::Unretained(&backend), &form_list)))); | 722 base::Unretained(&backend), &form_list))); |
| 723 | 723 |
| 724 RunBothThreads(); | 724 RunBothThreads(); |
| 725 | 725 |
| 726 // Quick check that we got something back. | 726 // Quick check that we got something back. |
| 727 EXPECT_EQ(1u, form_list.size()); | 727 EXPECT_EQ(1u, form_list.size()); |
| 728 STLDeleteElements(&form_list); | 728 STLDeleteElements(&form_list); |
| 729 } | 729 } |
| 730 | 730 |
| 731 EXPECT_EQ(3u, mock_keyring_items.size()); | 731 EXPECT_EQ(3u, mock_keyring_items.size()); |
| 732 if (mock_keyring_items.size() > 0) | 732 if (mock_keyring_items.size() > 0) |
| 733 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 733 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 734 if (mock_keyring_items.size() > 1) | 734 if (mock_keyring_items.size() > 1) |
| 735 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 735 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 736 if (mock_keyring_items.size() > 2) | 736 if (mock_keyring_items.size() > 2) |
| 737 CheckMockKeyringItem(&mock_keyring_items[2], form_google_, "chrome-24"); | 737 CheckMockKeyringItem(&mock_keyring_items[2], form_google_, "chrome-24"); |
| 738 } | 738 } |
| 739 | 739 |
| 740 TEST_F(NativeBackendGnomeTest, NoMigrationWithPrefSet) { | 740 TEST_F(NativeBackendGnomeTest, NoMigrationWithPrefSet) { |
| 741 // Reject attempts to migrate so we can populate the store. | 741 // Reject attempts to migrate so we can populate the store. |
| 742 mock_keyring_reject_local_ids = true; | 742 mock_keyring_reject_local_ids = true; |
| 743 | 743 |
| 744 { | 744 { |
| 745 NativeBackendGnome backend(42, profile_.GetPrefs()); | 745 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 746 backend.Init(); | 746 backend.Init(); |
| 747 | 747 |
| 748 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 748 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 749 base::IgnoreReturn(base::Callback<bool(void)>( | 749 base::IgnoreReturn<bool>(base::Bind( |
| 750 base::Bind(&NativeBackendGnome::AddLogin, | 750 &NativeBackendGnome::AddLogin, |
| 751 base::Unretained(&backend), form_google_)))); | 751 base::Unretained(&backend), form_google_))); |
| 752 | 752 |
| 753 RunBothThreads(); | 753 RunBothThreads(); |
| 754 } | 754 } |
| 755 | 755 |
| 756 EXPECT_EQ(1u, mock_keyring_items.size()); | 756 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 757 if (mock_keyring_items.size() > 0) | 757 if (mock_keyring_items.size() > 0) |
| 758 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 758 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 759 | 759 |
| 760 // Now allow migration, but also pretend that the it has already taken place. | 760 // Now allow migration, but also pretend that the it has already taken place. |
| 761 mock_keyring_reject_local_ids = false; | 761 mock_keyring_reject_local_ids = false; |
| 762 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); | 762 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); |
| 763 | 763 |
| 764 { | 764 { |
| 765 NativeBackendGnome backend(42, profile_.GetPrefs()); | 765 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 766 backend.Init(); | 766 backend.Init(); |
| 767 | 767 |
| 768 // Trigger the migration by adding a new login. | 768 // Trigger the migration by adding a new login. |
| 769 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 769 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 770 base::IgnoreReturn(base::Callback<bool(void)>( | 770 base::IgnoreReturn<bool>(base::Bind( |
| 771 base::Bind(&NativeBackendGnome::AddLogin, | 771 &NativeBackendGnome::AddLogin, |
| 772 base::Unretained(&backend), form_isc_)))); | 772 base::Unretained(&backend), form_isc_))); |
| 773 | 773 |
| 774 // Look up all logins; we expect only the one we added. | 774 // Look up all logins; we expect only the one we added. |
| 775 std::vector<PasswordForm*> form_list; | 775 std::vector<PasswordForm*> form_list; |
| 776 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 776 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 777 base::IgnoreReturn(base::Callback<bool(void)>( | 777 base::IgnoreReturn<bool>(base::Bind( |
| 778 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 778 &NativeBackendGnome::GetAutofillableLogins, |
| 779 base::Unretained(&backend), &form_list)))); | 779 base::Unretained(&backend), &form_list))); |
| 780 | 780 |
| 781 RunBothThreads(); | 781 RunBothThreads(); |
| 782 | 782 |
| 783 // Quick check that we got the right thing back. | 783 // Quick check that we got the right thing back. |
| 784 EXPECT_EQ(1u, form_list.size()); | 784 EXPECT_EQ(1u, form_list.size()); |
| 785 if (form_list.size() > 0) | 785 if (form_list.size() > 0) |
| 786 EXPECT_EQ(form_isc_.signon_realm, form_list[0]->signon_realm); | 786 EXPECT_EQ(form_isc_.signon_realm, form_list[0]->signon_realm); |
| 787 STLDeleteElements(&form_list); | 787 STLDeleteElements(&form_list); |
| 788 } | 788 } |
| 789 | 789 |
| 790 EXPECT_EQ(2u, mock_keyring_items.size()); | 790 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 791 if (mock_keyring_items.size() > 0) | 791 if (mock_keyring_items.size() > 0) |
| 792 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 792 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 793 if (mock_keyring_items.size() > 1) | 793 if (mock_keyring_items.size() > 1) |
| 794 CheckMockKeyringItem(&mock_keyring_items[1], form_isc_, "chrome-42"); | 794 CheckMockKeyringItem(&mock_keyring_items[1], form_isc_, "chrome-42"); |
| 795 } | 795 } |
| 796 | 796 |
| 797 TEST_F(NativeBackendGnomeTest, DeleteMigratedPasswordIsIsolated) { | 797 TEST_F(NativeBackendGnomeTest, DeleteMigratedPasswordIsIsolated) { |
| 798 // Reject attempts to migrate so we can populate the store. | 798 // Reject attempts to migrate so we can populate the store. |
| 799 mock_keyring_reject_local_ids = true; | 799 mock_keyring_reject_local_ids = true; |
| 800 | 800 |
| 801 { | 801 { |
| 802 NativeBackendGnome backend(42, profile_.GetPrefs()); | 802 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 803 backend.Init(); | 803 backend.Init(); |
| 804 | 804 |
| 805 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 805 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 806 base::IgnoreReturn(base::Callback<bool(void)>( | 806 base::IgnoreReturn<bool>(base::Bind( |
| 807 base::Bind(&NativeBackendGnome::AddLogin, | 807 &NativeBackendGnome::AddLogin, |
| 808 base::Unretained(&backend), form_google_)))); | 808 base::Unretained(&backend), form_google_))); |
| 809 | 809 |
| 810 RunBothThreads(); | 810 RunBothThreads(); |
| 811 } | 811 } |
| 812 | 812 |
| 813 EXPECT_EQ(1u, mock_keyring_items.size()); | 813 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 814 if (mock_keyring_items.size() > 0) | 814 if (mock_keyring_items.size() > 0) |
| 815 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 815 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 816 | 816 |
| 817 // Now allow the migration. | 817 // Now allow the migration. |
| 818 mock_keyring_reject_local_ids = false; | 818 mock_keyring_reject_local_ids = false; |
| 819 | 819 |
| 820 { | 820 { |
| 821 NativeBackendGnome backend(42, profile_.GetPrefs()); | 821 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 822 backend.Init(); | 822 backend.Init(); |
| 823 | 823 |
| 824 // Trigger the migration by looking something up. | 824 // Trigger the migration by looking something up. |
| 825 std::vector<PasswordForm*> form_list; | 825 std::vector<PasswordForm*> form_list; |
| 826 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 826 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 827 base::IgnoreReturn(base::Callback<bool(void)>( | 827 base::IgnoreReturn<bool>(base::Bind( |
| 828 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 828 &NativeBackendGnome::GetAutofillableLogins, |
| 829 base::Unretained(&backend), &form_list)))); | 829 base::Unretained(&backend), &form_list))); |
| 830 | 830 |
| 831 RunBothThreads(); | 831 RunBothThreads(); |
| 832 | 832 |
| 833 // Quick check that we got something back. | 833 // Quick check that we got something back. |
| 834 EXPECT_EQ(1u, form_list.size()); | 834 EXPECT_EQ(1u, form_list.size()); |
| 835 STLDeleteElements(&form_list); | 835 STLDeleteElements(&form_list); |
| 836 } | 836 } |
| 837 | 837 |
| 838 EXPECT_EQ(2u, mock_keyring_items.size()); | 838 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 839 if (mock_keyring_items.size() > 0) | 839 if (mock_keyring_items.size() > 0) |
| 840 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 840 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 841 if (mock_keyring_items.size() > 1) | 841 if (mock_keyring_items.size() > 1) |
| 842 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 842 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 843 | 843 |
| 844 // Check that we have set the persistent preference. | 844 // Check that we have set the persistent preference. |
| 845 EXPECT_TRUE( | 845 EXPECT_TRUE( |
| 846 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); | 846 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); |
| 847 | 847 |
| 848 // Normally we'd actually have a different profile. But in the test just reset | 848 // Normally we'd actually have a different profile. But in the test just reset |
| 849 // the profile's persistent pref; we pass in the local profile id anyway. | 849 // the profile's persistent pref; we pass in the local profile id anyway. |
| 850 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, false); | 850 profile_.GetPrefs()->SetBoolean(prefs::kPasswordsUseLocalProfileId, false); |
| 851 | 851 |
| 852 { | 852 { |
| 853 NativeBackendGnome backend(24, profile_.GetPrefs()); | 853 NativeBackendGnome backend(24, profile_.GetPrefs()); |
| 854 backend.Init(); | 854 backend.Init(); |
| 855 | 855 |
| 856 // Trigger the migration by looking something up. | 856 // Trigger the migration by looking something up. |
| 857 std::vector<PasswordForm*> form_list; | 857 std::vector<PasswordForm*> form_list; |
| 858 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 858 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 859 base::IgnoreReturn(base::Callback<bool(void)>( | 859 base::IgnoreReturn<bool>(base::Bind( |
| 860 base::Bind(&NativeBackendGnome::GetAutofillableLogins, | 860 &NativeBackendGnome::GetAutofillableLogins, |
| 861 base::Unretained(&backend), &form_list)))); | 861 base::Unretained(&backend), &form_list))); |
| 862 | 862 |
| 863 RunBothThreads(); | 863 RunBothThreads(); |
| 864 | 864 |
| 865 // Quick check that we got something back. | 865 // Quick check that we got something back. |
| 866 EXPECT_EQ(1u, form_list.size()); | 866 EXPECT_EQ(1u, form_list.size()); |
| 867 STLDeleteElements(&form_list); | 867 STLDeleteElements(&form_list); |
| 868 | 868 |
| 869 // There should be three passwords now. | 869 // There should be three passwords now. |
| 870 EXPECT_EQ(3u, mock_keyring_items.size()); | 870 EXPECT_EQ(3u, mock_keyring_items.size()); |
| 871 if (mock_keyring_items.size() > 0) | 871 if (mock_keyring_items.size() > 0) |
| 872 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 872 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 873 if (mock_keyring_items.size() > 1) | 873 if (mock_keyring_items.size() > 1) |
| 874 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 874 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 875 if (mock_keyring_items.size() > 2) | 875 if (mock_keyring_items.size() > 2) |
| 876 CheckMockKeyringItem(&mock_keyring_items[2], form_google_, "chrome-24"); | 876 CheckMockKeyringItem(&mock_keyring_items[2], form_google_, "chrome-24"); |
| 877 | 877 |
| 878 // Now delete the password from this second profile. | 878 // Now delete the password from this second profile. |
| 879 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 879 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 880 base::IgnoreReturn(base::Callback<bool(void)>( | 880 base::IgnoreReturn<bool>(base::Bind( |
| 881 base::Bind(&NativeBackendGnome::RemoveLogin, | 881 &NativeBackendGnome::RemoveLogin, |
| 882 base::Unretained(&backend), form_google_)))); | 882 base::Unretained(&backend), form_google_))); |
| 883 | 883 |
| 884 RunBothThreads(); | 884 RunBothThreads(); |
| 885 | 885 |
| 886 // The other two copies of the password in different profiles should remain. | 886 // The other two copies of the password in different profiles should remain. |
| 887 EXPECT_EQ(2u, mock_keyring_items.size()); | 887 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 888 if (mock_keyring_items.size() > 0) | 888 if (mock_keyring_items.size() > 0) |
| 889 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 889 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 890 if (mock_keyring_items.size() > 1) | 890 if (mock_keyring_items.size() > 1) |
| 891 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 891 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 892 } | 892 } |
| 893 } | 893 } |
| OLD | NEW |