Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/browser/password_manager/password_store_mac_unittest.cc

Issue 99303009: Merge 241255 "[Mac] Passwords: Don't always prompt to access pas..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1750/src/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "testing/gmock/include/gmock/gmock.h" 5 #include "testing/gmock/include/gmock/gmock.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 updates[i].form_data)); 1110 updates[i].form_data));
1111 store_->UpdateLogin(*form); 1111 store_->UpdateLogin(*form);
1112 } 1112 }
1113 1113
1114 // Do a store-level query to wait for all the operations above to be done. 1114 // Do a store-level query to wait for all the operations above to be done.
1115 MockPasswordStoreConsumer consumer; 1115 MockPasswordStoreConsumer consumer;
1116 ON_CALL(consumer, OnGetPasswordStoreResults(_)).WillByDefault( 1116 ON_CALL(consumer, OnGetPasswordStoreResults(_)).WillByDefault(
1117 QuitUIMessageLoop()); 1117 QuitUIMessageLoop());
1118 EXPECT_CALL(consumer, OnGetPasswordStoreResults(_)).WillOnce( 1118 EXPECT_CALL(consumer, OnGetPasswordStoreResults(_)).WillOnce(
1119 DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); 1119 DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop()));
1120 store_->GetLogins(*joint_form, &consumer); 1120 store_->GetLogins(*joint_form, PasswordStore::ALLOW_PROMPT, &consumer);
1121 base::MessageLoop::current()->Run(); 1121 base::MessageLoop::current()->Run();
1122 1122
1123 MacKeychainPasswordFormAdapter keychain_adapter(keychain_); 1123 MacKeychainPasswordFormAdapter keychain_adapter(keychain_);
1124 for (unsigned int i = 0; i < ARRAYSIZE_UNSAFE(updates); ++i) { 1124 for (unsigned int i = 0; i < ARRAYSIZE_UNSAFE(updates); ++i) {
1125 scoped_ptr<PasswordForm> query_form( 1125 scoped_ptr<PasswordForm> query_form(
1126 CreatePasswordFormFromData(updates[i].form_data)); 1126 CreatePasswordFormFromData(updates[i].form_data));
1127 1127
1128 std::vector<PasswordForm*> matching_items = 1128 std::vector<PasswordForm*> matching_items =
1129 keychain_adapter.PasswordsFillingForm(*query_form); 1129 keychain_adapter.PasswordsFillingForm(*query_form);
1130 if (updates[i].password) { 1130 if (updates[i].password) {
1131 EXPECT_GT(matching_items.size(), 0U) << "iteration " << i; 1131 EXPECT_GT(matching_items.size(), 0U) << "iteration " << i;
1132 if (matching_items.size() >= 1) 1132 if (matching_items.size() >= 1)
1133 EXPECT_EQ(ASCIIToUTF16(updates[i].password), 1133 EXPECT_EQ(ASCIIToUTF16(updates[i].password),
1134 matching_items[0]->password_value) << "iteration " << i; 1134 matching_items[0]->password_value) << "iteration " << i;
1135 } else { 1135 } else {
1136 EXPECT_EQ(0U, matching_items.size()) << "iteration " << i; 1136 EXPECT_EQ(0U, matching_items.size()) << "iteration " << i;
1137 } 1137 }
1138 STLDeleteElements(&matching_items); 1138 STLDeleteElements(&matching_items);
1139 1139
1140 login_db_->GetLogins(*query_form, &matching_items); 1140 login_db_->GetLogins(*query_form, &matching_items);
1141 EXPECT_EQ(updates[i].password ? 1U : 0U, matching_items.size()) 1141 EXPECT_EQ(updates[i].password ? 1U : 0U, matching_items.size())
1142 << "iteration " << i; 1142 << "iteration " << i;
1143 STLDeleteElements(&matching_items); 1143 STLDeleteElements(&matching_items);
1144 } 1144 }
1145 } 1145 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_mac.cc ('k') | chrome/browser/password_manager/password_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698