| 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 "chrome/browser/password_manager/password_store_mac.h" | 5 #include "chrome/browser/password_manager/password_store_mac.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 store_ = new TestPasswordStoreMac( | 1063 store_ = new TestPasswordStoreMac( |
| 1064 base::MessageLoopProxy::current(), | 1064 base::MessageLoopProxy::current(), |
| 1065 base::MessageLoopProxy::current(), | 1065 base::MessageLoopProxy::current(), |
| 1066 keychain_, | 1066 keychain_, |
| 1067 login_db_); | 1067 login_db_); |
| 1068 ASSERT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare(), "")); | 1068 ASSERT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare(), "")); |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 virtual void TearDown() { | 1071 virtual void TearDown() { |
| 1072 store_->Shutdown(); | 1072 store_->Shutdown(); |
| 1073 EXPECT_FALSE(store_->GetBackgroundTaskRunner()); | 1073 EXPECT_FALSE(store_->GetBackgroundTaskRunner().get()); |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 void WaitForStoreUpdate() { | 1076 void WaitForStoreUpdate() { |
| 1077 // Do a store-level query to wait for all the operations above to be done. | 1077 // Do a store-level query to wait for all the operations above to be done. |
| 1078 MockPasswordStoreConsumer consumer; | 1078 MockPasswordStoreConsumer consumer; |
| 1079 EXPECT_CALL(consumer, OnGetPasswordStoreResults(_)) | 1079 EXPECT_CALL(consumer, OnGetPasswordStoreResults(_)) |
| 1080 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); | 1080 .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); |
| 1081 store_->GetLogins(PasswordForm(), PasswordStore::ALLOW_PROMPT, &consumer); | 1081 store_->GetLogins(PasswordForm(), PasswordStore::ALLOW_PROMPT, &consumer); |
| 1082 base::MessageLoop::current()->Run(); | 1082 base::MessageLoop::current()->Run(); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 scoped_refptr<TestPasswordStoreMac> store() { return store_; } | 1085 TestPasswordStoreMac* store() { return store_.get(); } |
| 1086 | 1086 |
| 1087 MockAppleKeychain* keychain() { return keychain_; } | 1087 MockAppleKeychain* keychain() { return keychain_; } |
| 1088 | 1088 |
| 1089 protected: | 1089 protected: |
| 1090 base::MessageLoopForUI message_loop_; | 1090 base::MessageLoopForUI message_loop_; |
| 1091 content::TestBrowserThread ui_thread_; | 1091 content::TestBrowserThread ui_thread_; |
| 1092 | 1092 |
| 1093 MockAppleKeychain* keychain_; // Owned by store_. | 1093 MockAppleKeychain* keychain_; // Owned by store_. |
| 1094 LoginDatabase* login_db_; // Owned by store_. | 1094 LoginDatabase* login_db_; // Owned by store_. |
| 1095 scoped_refptr<TestPasswordStoreMac> store_; | 1095 scoped_refptr<TestPasswordStoreMac> store_; |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 ASSERT_EQ(1u, matching_items.size()); | 1436 ASSERT_EQ(1u, matching_items.size()); |
| 1437 EXPECT_EQ(ASCIIToUTF16("joe_user"), matching_items[0]->username_value); | 1437 EXPECT_EQ(ASCIIToUTF16("joe_user"), matching_items[0]->username_value); |
| 1438 matching_items.clear(); | 1438 matching_items.clear(); |
| 1439 | 1439 |
| 1440 // Check the third-party password is still there. | 1440 // Check the third-party password is still there. |
| 1441 owned_keychain_adapter.SetFindsOnlyOwnedItems(false); | 1441 owned_keychain_adapter.SetFindsOnlyOwnedItems(false); |
| 1442 matching_items.get() = owned_keychain_adapter.PasswordsFillingForm( | 1442 matching_items.get() = owned_keychain_adapter.PasswordsFillingForm( |
| 1443 "http://some.domain.com/insecure.html", PasswordForm::SCHEME_HTML); | 1443 "http://some.domain.com/insecure.html", PasswordForm::SCHEME_HTML); |
| 1444 ASSERT_EQ(1u, matching_items.size()); | 1444 ASSERT_EQ(1u, matching_items.size()); |
| 1445 } | 1445 } |
| OLD | NEW |