| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 STLDeleteContainerPointers(arg0.begin(), arg0.end()); | 121 STLDeleteContainerPointers(arg0.begin(), arg0.end()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 ACTION(QuitUIMessageLoop) { | 124 ACTION(QuitUIMessageLoop) { |
| 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 126 base::MessageLoop::current()->Quit(); | 126 base::MessageLoop::current()->Quit(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) { | 129 TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) { |
| 130 scoped_refptr<PasswordStoreDefault> store( | 130 scoped_refptr<PasswordStoreDefault> store( |
| 131 new PasswordStoreDefault(login_db_.release(), profile_.get())); | 131 new PasswordStoreDefault( |
| 132 base::MessageLoopProxy::current(), |
| 133 base::MessageLoopProxy::current(), |
| 134 login_db_.release(), |
| 135 profile_.get())); |
| 132 store->Init(); | 136 store->Init(); |
| 133 | 137 |
| 134 const time_t cutoff = 1325376000; // 00:00 Jan 1 2012 UTC | 138 const time_t cutoff = 1325376000; // 00:00 Jan 1 2012 UTC |
| 135 // The passwords are all empty because PasswordStoreDefault doesn't store the | 139 // The passwords are all empty because PasswordStoreDefault doesn't store the |
| 136 // actual passwords on OS X (they're stored in the Keychain instead). We could | 140 // actual passwords on OS X (they're stored in the Keychain instead). We could |
| 137 // special-case it, but it's easier to just have empty passwords. | 141 // special-case it, but it's easier to just have empty passwords. |
| 138 static const PasswordFormData form_data[] = { | 142 static const PasswordFormData form_data[] = { |
| 139 // A form on https://www.google.com/ older than the cutoff. Will be ignored. | 143 // A form on https://www.google.com/ older than the cutoff. Will be ignored. |
| 140 { PasswordForm::SCHEME_HTML, | 144 { PasswordForm::SCHEME_HTML, |
| 141 "https://www.google.com", | 145 "https://www.google.com", |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 .WillOnce(WithArg<0>(STLDeleteElements0())).RetiresOnSaturation(); | 261 .WillOnce(WithArg<0>(STLDeleteElements0())).RetiresOnSaturation(); |
| 258 | 262 |
| 259 store->GetLogins(www_google, PasswordStore::ALLOW_PROMPT, &consumer); | 263 store->GetLogins(www_google, PasswordStore::ALLOW_PROMPT, &consumer); |
| 260 store->GetLogins(accounts_google, PasswordStore::ALLOW_PROMPT, &consumer); | 264 store->GetLogins(accounts_google, PasswordStore::ALLOW_PROMPT, &consumer); |
| 261 store->GetLogins(bar_example, PasswordStore::ALLOW_PROMPT, &consumer); | 265 store->GetLogins(bar_example, PasswordStore::ALLOW_PROMPT, &consumer); |
| 262 | 266 |
| 263 base::MessageLoop::current()->Run(); | 267 base::MessageLoop::current()->Run(); |
| 264 | 268 |
| 265 STLDeleteElements(&all_forms); | 269 STLDeleteElements(&all_forms); |
| 266 } | 270 } |
| OLD | NEW |