| 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 EXPECT_EQ(2u, form_list.size()); | 564 EXPECT_EQ(2u, form_list.size()); |
| 565 STLDeleteElements(&form_list); | 565 STLDeleteElements(&form_list); |
| 566 | 566 |
| 567 EXPECT_EQ(1u, mock_keyring_items.size()); | 567 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 568 if (mock_keyring_items.size() > 0) | 568 if (mock_keyring_items.size() > 0) |
| 569 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 569 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 570 } | 570 } |
| 571 | 571 |
| 572 // TODO(mdm): add more basic (i.e. non-migration) tests here at some point. | 572 // TODO(mdm): add more basic (i.e. non-migration) tests here at some point. |
| 573 | 573 |
| 574 TEST_F(NativeBackendGnomeTest, MigrateOneLogin) { | 574 TEST_F(NativeBackendGnomeTest, DISABLED_MigrateOneLogin) { |
| 575 // Reject attempts to migrate so we can populate the store. | 575 // Reject attempts to migrate so we can populate the store. |
| 576 mock_keyring_reject_local_ids = true; | 576 mock_keyring_reject_local_ids = true; |
| 577 | 577 |
| 578 { | 578 { |
| 579 NativeBackendGnome backend(42, profile_.GetPrefs()); | 579 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 580 backend.Init(); | 580 backend.Init(); |
| 581 | 581 |
| 582 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 582 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 583 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), | 583 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), |
| 584 base::Unretained(&backend), form_google_)); | 584 base::Unretained(&backend), form_google_)); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 if (mock_keyring_items.size() > 0) | 655 if (mock_keyring_items.size() > 0) |
| 656 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 656 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 657 if (mock_keyring_items.size() > 1) | 657 if (mock_keyring_items.size() > 1) |
| 658 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 658 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 659 | 659 |
| 660 // Check that we have set the persistent preference. | 660 // Check that we have set the persistent preference. |
| 661 EXPECT_TRUE( | 661 EXPECT_TRUE( |
| 662 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); | 662 profile_.GetPrefs()->GetBoolean(prefs::kPasswordsUseLocalProfileId)); |
| 663 } | 663 } |
| 664 | 664 |
| 665 TEST_F(NativeBackendGnomeTest, MigrateToMultipleProfiles) { | 665 TEST_F(NativeBackendGnomeTest, DISABLED_MigrateToMultipleProfiles) { |
| 666 // Reject attempts to migrate so we can populate the store. | 666 // Reject attempts to migrate so we can populate the store. |
| 667 mock_keyring_reject_local_ids = true; | 667 mock_keyring_reject_local_ids = true; |
| 668 | 668 |
| 669 { | 669 { |
| 670 NativeBackendGnome backend(42, profile_.GetPrefs()); | 670 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 671 backend.Init(); | 671 backend.Init(); |
| 672 | 672 |
| 673 BrowserThread::PostTask( | 673 BrowserThread::PostTask( |
| 674 BrowserThread::DB, FROM_HERE, | 674 BrowserThread::DB, FROM_HERE, |
| 675 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), | 675 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 739 |
| 740 EXPECT_EQ(3u, mock_keyring_items.size()); | 740 EXPECT_EQ(3u, mock_keyring_items.size()); |
| 741 if (mock_keyring_items.size() > 0) | 741 if (mock_keyring_items.size() > 0) |
| 742 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 742 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 743 if (mock_keyring_items.size() > 1) | 743 if (mock_keyring_items.size() > 1) |
| 744 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 744 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 745 if (mock_keyring_items.size() > 2) | 745 if (mock_keyring_items.size() > 2) |
| 746 CheckMockKeyringItem(&mock_keyring_items[2], form_google_, "chrome-24"); | 746 CheckMockKeyringItem(&mock_keyring_items[2], form_google_, "chrome-24"); |
| 747 } | 747 } |
| 748 | 748 |
| 749 TEST_F(NativeBackendGnomeTest, NoMigrationWithPrefSet) { | 749 TEST_F(NativeBackendGnomeTest, DISABLED_NoMigrationWithPrefSet) { |
| 750 // Reject attempts to migrate so we can populate the store. | 750 // Reject attempts to migrate so we can populate the store. |
| 751 mock_keyring_reject_local_ids = true; | 751 mock_keyring_reject_local_ids = true; |
| 752 | 752 |
| 753 { | 753 { |
| 754 NativeBackendGnome backend(42, profile_.GetPrefs()); | 754 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 755 backend.Init(); | 755 backend.Init(); |
| 756 | 756 |
| 757 BrowserThread::PostTask( | 757 BrowserThread::PostTask( |
| 758 BrowserThread::DB, FROM_HERE, | 758 BrowserThread::DB, FROM_HERE, |
| 759 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), | 759 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 STLDeleteElements(&form_list); | 797 STLDeleteElements(&form_list); |
| 798 } | 798 } |
| 799 | 799 |
| 800 EXPECT_EQ(2u, mock_keyring_items.size()); | 800 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 801 if (mock_keyring_items.size() > 0) | 801 if (mock_keyring_items.size() > 0) |
| 802 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 802 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 803 if (mock_keyring_items.size() > 1) | 803 if (mock_keyring_items.size() > 1) |
| 804 CheckMockKeyringItem(&mock_keyring_items[1], form_isc_, "chrome-42"); | 804 CheckMockKeyringItem(&mock_keyring_items[1], form_isc_, "chrome-42"); |
| 805 } | 805 } |
| 806 | 806 |
| 807 TEST_F(NativeBackendGnomeTest, DeleteMigratedPasswordIsIsolated) { | 807 TEST_F(NativeBackendGnomeTest, DISABLED_DeleteMigratedPasswordIsIsolated) { |
| 808 // Reject attempts to migrate so we can populate the store. | 808 // Reject attempts to migrate so we can populate the store. |
| 809 mock_keyring_reject_local_ids = true; | 809 mock_keyring_reject_local_ids = true; |
| 810 | 810 |
| 811 { | 811 { |
| 812 NativeBackendGnome backend(42, profile_.GetPrefs()); | 812 NativeBackendGnome backend(42, profile_.GetPrefs()); |
| 813 backend.Init(); | 813 backend.Init(); |
| 814 | 814 |
| 815 BrowserThread::PostTask( | 815 BrowserThread::PostTask( |
| 816 BrowserThread::DB, FROM_HERE, | 816 BrowserThread::DB, FROM_HERE, |
| 817 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), | 817 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 RunBothThreads(); | 896 RunBothThreads(); |
| 897 | 897 |
| 898 // The other two copies of the password in different profiles should remain. | 898 // The other two copies of the password in different profiles should remain. |
| 899 EXPECT_EQ(2u, mock_keyring_items.size()); | 899 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 900 if (mock_keyring_items.size() > 0) | 900 if (mock_keyring_items.size() > 0) |
| 901 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 901 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 902 if (mock_keyring_items.size() > 1) | 902 if (mock_keyring_items.size() > 1) |
| 903 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 903 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 904 } | 904 } |
| 905 } | 905 } |
| OLD | NEW |