| 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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 base::Unretained(&backend), form_google_), | 1033 base::Unretained(&backend), form_google_), |
| 1034 base::Bind(&CheckPasswordChanges, changes)); | 1034 base::Bind(&CheckPasswordChanges, changes)); |
| 1035 | 1035 |
| 1036 RunBothThreads(); | 1036 RunBothThreads(); |
| 1037 | 1037 |
| 1038 EXPECT_EQ(1u, mock_keyring_items.size()); | 1038 EXPECT_EQ(1u, mock_keyring_items.size()); |
| 1039 if (mock_keyring_items.size() > 0) | 1039 if (mock_keyring_items.size() > 0) |
| 1040 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | 1040 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 TEST_F(NativeBackendGnomeTest, ListLoginsAppends) { | |
| 1044 NativeBackendGnome backend(42); | |
| 1045 backend.Init(); | |
| 1046 | |
| 1047 BrowserThread::PostTask( | |
| 1048 BrowserThread::DB, FROM_HERE, | |
| 1049 base::Bind(base::IgnoreResult(&NativeBackendGnome::AddLogin), | |
| 1050 base::Unretained(&backend), form_google_)); | |
| 1051 | |
| 1052 // Send the same request twice with the same list both times. | |
| 1053 ScopedVector<autofill::PasswordForm> form_list; | |
| 1054 BrowserThread::PostTask( | |
| 1055 BrowserThread::DB, FROM_HERE, | |
| 1056 base::Bind( | |
| 1057 base::IgnoreResult(&NativeBackendGnome::GetAutofillableLogins), | |
| 1058 base::Unretained(&backend), &form_list)); | |
| 1059 BrowserThread::PostTask( | |
| 1060 BrowserThread::DB, FROM_HERE, | |
| 1061 base::Bind( | |
| 1062 base::IgnoreResult(&NativeBackendGnome::GetAutofillableLogins), | |
| 1063 base::Unretained(&backend), &form_list)); | |
| 1064 | |
| 1065 RunBothThreads(); | |
| 1066 | |
| 1067 // Quick check that we got two results back. | |
| 1068 EXPECT_EQ(2u, form_list.size()); | |
| 1069 | |
| 1070 EXPECT_EQ(1u, mock_keyring_items.size()); | |
| 1071 if (mock_keyring_items.size() > 0) | |
| 1072 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome-42"); | |
| 1073 } | |
| 1074 | |
| 1075 TEST_F(NativeBackendGnomeTest, AndroidCredentials) { | 1043 TEST_F(NativeBackendGnomeTest, AndroidCredentials) { |
| 1076 NativeBackendGnome backend(42); | 1044 NativeBackendGnome backend(42); |
| 1077 backend.Init(); | 1045 backend.Init(); |
| 1078 | 1046 |
| 1079 PasswordForm observed_android_form; | 1047 PasswordForm observed_android_form; |
| 1080 observed_android_form.scheme = PasswordForm::SCHEME_HTML; | 1048 observed_android_form.scheme = PasswordForm::SCHEME_HTML; |
| 1081 observed_android_form.signon_realm = | 1049 observed_android_form.signon_realm = |
| 1082 "android://7x7IDboo8u9YKraUsbmVkuf1-@net.rateflix.app/"; | 1050 "android://7x7IDboo8u9YKraUsbmVkuf1-@net.rateflix.app/"; |
| 1083 PasswordForm saved_android_form = observed_android_form; | 1051 PasswordForm saved_android_form = observed_android_form; |
| 1084 saved_android_form.username_value = base::UTF8ToUTF16("randomusername"); | 1052 saved_android_form.username_value = base::UTF8ToUTF16("randomusername"); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1105 | 1073 |
| 1106 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) { | 1074 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) { |
| 1107 CheckRemoveLoginsBetween(CREATED); | 1075 CheckRemoveLoginsBetween(CREATED); |
| 1108 } | 1076 } |
| 1109 | 1077 |
| 1110 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) { | 1078 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) { |
| 1111 CheckRemoveLoginsBetween(SYNCED); | 1079 CheckRemoveLoginsBetween(SYNCED); |
| 1112 } | 1080 } |
| 1113 | 1081 |
| 1114 // TODO(mdm): add more basic tests here at some point. | 1082 // TODO(mdm): add more basic tests here at some point. |
| OLD | NEW |