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 <stdarg.h> | 5 #include <stdarg.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 BrowserThread::PostTask( | 905 BrowserThread::PostTask( |
906 BrowserThread::DB, FROM_HERE, | 906 BrowserThread::DB, FROM_HERE, |
907 base::Bind(base::IgnoreResult(&NativeBackendGnome::RemoveLogin), | 907 base::Bind(base::IgnoreResult(&NativeBackendGnome::RemoveLogin), |
908 base::Unretained(&backend), form_google_)); | 908 base::Unretained(&backend), form_google_)); |
909 | 909 |
910 RunBothThreads(); | 910 RunBothThreads(); |
911 | 911 |
912 EXPECT_EQ(0u, mock_keyring_items.size()); | 912 EXPECT_EQ(0u, mock_keyring_items.size()); |
913 } | 913 } |
914 | 914 |
| 915 // Verify fix for http://crbug.com/408783. |
| 916 TEST_F(NativeBackendGnomeTest, RemoveLoginActionMismatch) { |
| 917 NativeBackendGnome backend(42); |
| 918 backend.Init(); |
| 919 |
| 920 BrowserThread::PostTask( |
| 921 BrowserThread::DB, FROM_HERE, |
| 922 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), |
| 923 base::Unretained(&backend), form_google_)); |
| 924 |
| 925 RunBothThreads(); |
| 926 |
| 927 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 928 if (mock_keyring_items.size() > 0) |
| 929 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 930 |
| 931 // Action url match not required for removal. |
| 932 form_google_.action = GURL("https://some.other.url.com/path"); |
| 933 |
| 934 BrowserThread::PostTask( |
| 935 BrowserThread::DB, FROM_HERE, |
| 936 base::Bind(base::IgnoreResult(&NativeBackendGnome::RemoveLogin), |
| 937 base::Unretained(&backend), form_google_)); |
| 938 |
| 939 RunBothThreads(); |
| 940 |
| 941 EXPECT_EQ(0u, mock_keyring_items.size()); |
| 942 } |
| 943 |
915 TEST_F(NativeBackendGnomeTest, RemoveNonexistentLogin) { | 944 TEST_F(NativeBackendGnomeTest, RemoveNonexistentLogin) { |
916 NativeBackendGnome backend(42); | 945 NativeBackendGnome backend(42); |
917 backend.Init(); | 946 backend.Init(); |
918 | 947 |
919 // First add an unrelated login. | 948 // First add an unrelated login. |
920 BrowserThread::PostTask( | 949 BrowserThread::PostTask( |
921 BrowserThread::DB, FROM_HERE, | 950 BrowserThread::DB, FROM_HERE, |
922 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), | 951 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), |
923 base::Unretained(&backend), form_google_)); | 952 base::Unretained(&backend), form_google_)); |
924 | 953 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 | 1083 |
1055 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) { | 1084 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) { |
1056 CheckRemoveLoginsBetween(CREATED); | 1085 CheckRemoveLoginsBetween(CREATED); |
1057 } | 1086 } |
1058 | 1087 |
1059 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) { | 1088 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) { |
1060 CheckRemoveLoginsBetween(SYNCED); | 1089 CheckRemoveLoginsBetween(SYNCED); |
1061 } | 1090 } |
1062 | 1091 |
1063 // TODO(mdm): add more basic tests here at some point. | 1092 // TODO(mdm): add more basic tests here at some point. |
OLD | NEW |