| 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 "chrome/test/live_sync/live_passwords_sync_test.h" | 5 #include "chrome/test/live_sync/live_passwords_sync_test.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/password_manager/password_store_consumer.h" | 10 #include "chrome/browser/password_manager/password_store_consumer.h" |
| 11 #include "chrome/browser/password_manager/password_store.h" | 11 #include "chrome/browser/password_manager/password_store.h" |
| 12 #include "chrome/browser/sync/profile_sync_service_harness.h" | 12 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 13 #include "chrome/test/ui_test_utils.h" | 13 #include "chrome/test/ui_test_utils.h" |
| 14 #include "content/browser/browser_thread.h" | 14 #include "content/browser/browser_thread.h" |
| 15 | 15 |
| 16 using webkit_glue::PasswordForm; | 16 using webkit_glue::PasswordForm; |
| 17 | 17 |
| 18 const std::string kFakeSignonRealm = "http://fake-domain.google.com/"; | 18 const std::string kFakeSignonRealm = "http://fake-signon-realm.google.com/"; |
| 19 | 19 |
| 20 // We use a WaitableEvent to wait on AddLogin instead of running the UI message | 20 // We use a WaitableEvent to wait on AddLogin instead of running the UI message |
| 21 // loop because of a restriction that prevents a DB thread from initiating a | 21 // loop because of a restriction that prevents a DB thread from initiating a |
| 22 // quit of the UI message loop. | 22 // quit of the UI message loop. |
| 23 void PasswordStoreCallback(base::WaitableEvent* wait_event) { | 23 void PasswordStoreCallback(base::WaitableEvent* wait_event) { |
| 24 // Wake up LivePasswordsSyncTest::AddLogin. | 24 // Wake up LivePasswordsSyncTest::AddLogin. |
| 25 wait_event->Signal(); | 25 wait_event->Signal(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 class PasswordStoreConsumerHelper : public PasswordStoreConsumer { | 28 class PasswordStoreConsumerHelper : public PasswordStoreConsumer { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 std::vector<PasswordForm> forms; | 115 std::vector<PasswordForm> forms; |
| 116 GetLogins(GetVerifierPasswordStore(), forms); | 116 GetLogins(GetVerifierPasswordStore(), forms); |
| 117 for (std::vector<PasswordForm>::iterator it = forms.begin(); | 117 for (std::vector<PasswordForm>::iterator it = forms.begin(); |
| 118 it != forms.end(); ++it) { | 118 it != forms.end(); ++it) { |
| 119 GetVerifierPasswordStore()->RemoveLogin(*it); | 119 GetVerifierPasswordStore()->RemoveLogin(*it); |
| 120 } | 120 } |
| 121 forms.clear(); | 121 forms.clear(); |
| 122 GetLogins(GetVerifierPasswordStore(), forms); | 122 GetLogins(GetVerifierPasswordStore(), forms); |
| 123 ASSERT_EQ(0U, forms.size()); | 123 ASSERT_EQ(0U, forms.size()); |
| 124 } | 124 } |
| OLD | NEW |