Chromium Code Reviews| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <map> | 6 #include <map> |
| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 | 533 |
| 534 EXPECT_FALSE(wallet_.hasFolder("Chrome Form Data")); | 534 EXPECT_FALSE(wallet_.hasFolder("Chrome Form Data")); |
| 535 | 535 |
| 536 std::vector<const PasswordForm*> forms; | 536 std::vector<const PasswordForm*> forms; |
| 537 forms.push_back(&form_google_); | 537 forms.push_back(&form_google_); |
| 538 ExpectationArray expected; | 538 ExpectationArray expected; |
| 539 expected.push_back(make_pair(std::string(form_google_.signon_realm), forms)); | 539 expected.push_back(make_pair(std::string(form_google_.signon_realm), forms)); |
| 540 CheckPasswordForms("Chrome Form Data (42)", expected); | 540 CheckPasswordForms("Chrome Form Data (42)", expected); |
| 541 } | 541 } |
| 542 | 542 |
| 543 TEST_F(NativeBackendKWalletTest, BasicUpdateLogin) { | |
|
Garrett Casto
2014/05/21 19:14:20
As with the other test, can you check that updatin
vasilii
2014/05/22 11:38:14
Done.
| |
| 544 NativeBackendKWalletStub backend(42); | |
| 545 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); | |
| 546 | |
| 547 BrowserThread::PostTask( | |
| 548 BrowserThread::DB, FROM_HERE, | |
| 549 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), | |
| 550 base::Unretained(&backend), form_google_)); | |
| 551 | |
| 552 RunDBThread(); | |
| 553 | |
| 554 PasswordForm new_form_google(form_google_); | |
| 555 new_form_google.times_used = 10; | |
| 556 new_form_google.action = GURL("http://www.google.com/different/login"); | |
| 557 | |
| 558 // Update login | |
| 559 PasswordStoreChangeList changes; | |
| 560 BrowserThread::PostTask( | |
| 561 BrowserThread::DB, FROM_HERE, | |
| 562 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::UpdateLogin), | |
| 563 base::Unretained(&backend), | |
| 564 new_form_google, | |
| 565 base::Unretained(&changes))); | |
| 566 RunDBThread(); | |
| 567 | |
| 568 ASSERT_EQ(1u, changes.size()); | |
| 569 EXPECT_EQ(PasswordStoreChange::UPDATE, changes.front().type()); | |
| 570 EXPECT_EQ(new_form_google, changes.front().form()); | |
| 571 | |
| 572 std::vector<const PasswordForm*> forms; | |
| 573 forms.push_back(&new_form_google); | |
| 574 ExpectationArray expected; | |
| 575 expected.push_back(make_pair(std::string(form_google_.signon_realm), forms)); | |
| 576 CheckPasswordForms("Chrome Form Data (42)", expected); | |
| 577 } | |
| 578 | |
| 543 TEST_F(NativeBackendKWalletTest, BasicListLogins) { | 579 TEST_F(NativeBackendKWalletTest, BasicListLogins) { |
| 544 NativeBackendKWalletStub backend(42); | 580 NativeBackendKWalletStub backend(42); |
| 545 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); | 581 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); |
| 546 | 582 |
| 547 BrowserThread::PostTask( | 583 BrowserThread::PostTask( |
| 548 BrowserThread::DB, FROM_HERE, | 584 BrowserThread::DB, FROM_HERE, |
| 549 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), | 585 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), |
| 550 base::Unretained(&backend), form_google_)); | 586 base::Unretained(&backend), form_google_)); |
| 551 | 587 |
| 552 std::vector<PasswordForm*> form_list; | 588 std::vector<PasswordForm*> form_list; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 CheckVersion0Pickle(false, PasswordForm::SCHEME_HTML); | 857 CheckVersion0Pickle(false, PasswordForm::SCHEME_HTML); |
| 822 } | 858 } |
| 823 | 859 |
| 824 TEST_F(NativeBackendKWalletPickleTest, ReadsOld64BitHTTPPickles) { | 860 TEST_F(NativeBackendKWalletPickleTest, ReadsOld64BitHTTPPickles) { |
| 825 CheckVersion0Pickle(false, PasswordForm::SCHEME_BASIC); | 861 CheckVersion0Pickle(false, PasswordForm::SCHEME_BASIC); |
| 826 } | 862 } |
| 827 | 863 |
| 828 TEST_F(NativeBackendKWalletPickleTest, CheckVersion1Pickle) { | 864 TEST_F(NativeBackendKWalletPickleTest, CheckVersion1Pickle) { |
| 829 CheckVersion1Pickle(); | 865 CheckVersion1Pickle(); |
| 830 } | 866 } |
| OLD | NEW |