| 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 <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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 std::vector<const PasswordForm*> forms; | 689 std::vector<const PasswordForm*> forms; |
| 690 forms.push_back(&form_google_); | 690 forms.push_back(&form_google_); |
| 691 ExpectationArray expected; | 691 ExpectationArray expected; |
| 692 expected.push_back(make_pair(std::string(form_google_.signon_realm), forms)); | 692 expected.push_back(make_pair(std::string(form_google_.signon_realm), forms)); |
| 693 CheckPasswordForms("Chrome Form Data (42)", expected); | 693 CheckPasswordForms("Chrome Form Data (42)", expected); |
| 694 } | 694 } |
| 695 | 695 |
| 696 // TODO(mdm): add more basic (i.e. non-migration) tests here at some point. | 696 // TODO(mdm): add more basic (i.e. non-migration) tests here at some point. |
| 697 // (For example tests for storing >1 password per realm pickle.) | 697 // (For example tests for storing >1 password per realm pickle.) |
| 698 | 698 |
| 699 TEST_F(NativeBackendKWalletTest, MigrateOneLogin) { | 699 TEST_F(NativeBackendKWalletTest, DISABLED_MigrateOneLogin) { |
| 700 // Reject attempts to migrate so we can populate the store. | 700 // Reject attempts to migrate so we can populate the store. |
| 701 wallet_.set_reject_local_folders(true); | 701 wallet_.set_reject_local_folders(true); |
| 702 | 702 |
| 703 { | 703 { |
| 704 NativeBackendKWalletStub backend(42, profile_.GetPrefs()); | 704 NativeBackendKWalletStub backend(42, profile_.GetPrefs()); |
| 705 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); | 705 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); |
| 706 | 706 |
| 707 BrowserThread::PostTask( | 707 BrowserThread::PostTask( |
| 708 BrowserThread::DB, FROM_HERE, | 708 BrowserThread::DB, FROM_HERE, |
| 709 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), | 709 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 } | 757 } |
| 758 | 758 |
| 759 CheckPasswordForms("Chrome Form Data", expected); | 759 CheckPasswordForms("Chrome Form Data", expected); |
| 760 CheckPasswordForms("Chrome Form Data (42)", expected); | 760 CheckPasswordForms("Chrome Form Data (42)", expected); |
| 761 | 761 |
| 762 // Check that we have set the persistent preference. | 762 // Check that we have set the persistent preference. |
| 763 EXPECT_TRUE( | 763 EXPECT_TRUE( |
| 764 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); | 764 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); |
| 765 } | 765 } |
| 766 | 766 |
| 767 TEST_F(NativeBackendKWalletTest, MigrateToMultipleProfiles) { | 767 TEST_F(NativeBackendKWalletTest, DISABLED_MigrateToMultipleProfiles) { |
| 768 // Reject attempts to migrate so we can populate the store. | 768 // Reject attempts to migrate so we can populate the store. |
| 769 wallet_.set_reject_local_folders(true); | 769 wallet_.set_reject_local_folders(true); |
| 770 | 770 |
| 771 { | 771 { |
| 772 NativeBackendKWalletStub backend(42, profile_.GetPrefs()); | 772 NativeBackendKWalletStub backend(42, profile_.GetPrefs()); |
| 773 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); | 773 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); |
| 774 | 774 |
| 775 BrowserThread::PostTask( | 775 BrowserThread::PostTask( |
| 776 BrowserThread::DB, FROM_HERE, | 776 BrowserThread::DB, FROM_HERE, |
| 777 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), | 777 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 // Quick check that we got something back. | 840 // Quick check that we got something back. |
| 841 EXPECT_EQ(1u, form_list.size()); | 841 EXPECT_EQ(1u, form_list.size()); |
| 842 STLDeleteElements(&form_list); | 842 STLDeleteElements(&form_list); |
| 843 } | 843 } |
| 844 | 844 |
| 845 CheckPasswordForms("Chrome Form Data", expected); | 845 CheckPasswordForms("Chrome Form Data", expected); |
| 846 CheckPasswordForms("Chrome Form Data (42)", expected); | 846 CheckPasswordForms("Chrome Form Data (42)", expected); |
| 847 CheckPasswordForms("Chrome Form Data (24)", expected); | 847 CheckPasswordForms("Chrome Form Data (24)", expected); |
| 848 } | 848 } |
| 849 | 849 |
| 850 TEST_F(NativeBackendKWalletTest, NoMigrationWithPrefSet) { | 850 TEST_F(NativeBackendKWalletTest, DISABLED_NoMigrationWithPrefSet) { |
| 851 // Reject attempts to migrate so we can populate the store. | 851 // Reject attempts to migrate so we can populate the store. |
| 852 wallet_.set_reject_local_folders(true); | 852 wallet_.set_reject_local_folders(true); |
| 853 | 853 |
| 854 { | 854 { |
| 855 NativeBackendKWalletStub backend(42, profile_.GetPrefs()); | 855 NativeBackendKWalletStub backend(42, profile_.GetPrefs()); |
| 856 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); | 856 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); |
| 857 | 857 |
| 858 BrowserThread::PostTask( | 858 BrowserThread::PostTask( |
| 859 BrowserThread::DB, FROM_HERE, | 859 BrowserThread::DB, FROM_HERE, |
| 860 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), | 860 base::Bind(base::IgnoreResult(&NativeBackendKWalletStub::AddLogin), |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 } | 904 } |
| 905 | 905 |
| 906 CheckPasswordForms("Chrome Form Data", expected); | 906 CheckPasswordForms("Chrome Form Data", expected); |
| 907 | 907 |
| 908 forms[0] = &form_isc_; | 908 forms[0] = &form_isc_; |
| 909 expected.clear(); | 909 expected.clear(); |
| 910 expected.push_back(make_pair(std::string(form_isc_.signon_realm), forms)); | 910 expected.push_back(make_pair(std::string(form_isc_.signon_realm), forms)); |
| 911 CheckPasswordForms("Chrome Form Data (42)", expected); | 911 CheckPasswordForms("Chrome Form Data (42)", expected); |
| 912 } | 912 } |
| 913 | 913 |
| 914 TEST_F(NativeBackendKWalletTest, DeleteMigratedPasswordIsIsolated) { | 914 TEST_F(NativeBackendKWalletTest, DISABLED_DeleteMigratedPasswordIsIsolated) { |
| 915 // Reject attempts to migrate so we can populate the store. | 915 // Reject attempts to migrate so we can populate the store. |
| 916 wallet_.set_reject_local_folders(true); | 916 wallet_.set_reject_local_folders(true); |
| 917 | 917 |
| 918 { | 918 { |
| 919 NativeBackendKWalletStub backend(42, profile_.GetPrefs()); | 919 NativeBackendKWalletStub backend(42, profile_.GetPrefs()); |
| 920 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); | 920 EXPECT_TRUE(backend.InitWithBus(mock_session_bus_)); |
| 921 | 921 |
| 922 BrowserThread::PostTask( | 922 BrowserThread::PostTask( |
| 923 BrowserThread::DB, FROM_HERE, | 923 BrowserThread::DB, FROM_HERE, |
| 924 base::Bind( | 924 base::Bind( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1003 |
| 1004 RunDBThread(); | 1004 RunDBThread(); |
| 1005 | 1005 |
| 1006 // The other two copies of the password in different profiles should remain. | 1006 // The other two copies of the password in different profiles should remain. |
| 1007 CheckPasswordForms("Chrome Form Data", expected); | 1007 CheckPasswordForms("Chrome Form Data", expected); |
| 1008 CheckPasswordForms("Chrome Form Data (42)", expected); | 1008 CheckPasswordForms("Chrome Form Data (42)", expected); |
| 1009 expected.clear(); | 1009 expected.clear(); |
| 1010 CheckPasswordForms("Chrome Form Data (24)", expected); | 1010 CheckPasswordForms("Chrome Form Data (24)", expected); |
| 1011 } | 1011 } |
| 1012 } | 1012 } |
| OLD | NEW |