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

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

Issue 459103005: Introduce new PasswordForm attributes for Credential Management API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compilation on Win Created 6 years, 4 months 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 "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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (form_data.action) 196 if (form_data.action)
197 form->action = GURL(form_data.action); 197 form->action = GURL(form_data.action);
198 if (form_data.submit_element) 198 if (form_data.submit_element)
199 form->submit_element = WideToUTF16(form_data.submit_element); 199 form->submit_element = WideToUTF16(form_data.submit_element);
200 if (form_data.username_element) 200 if (form_data.username_element)
201 form->username_element = WideToUTF16(form_data.username_element); 201 form->username_element = WideToUTF16(form_data.username_element);
202 if (form_data.password_element) 202 if (form_data.password_element)
203 form->password_element = WideToUTF16(form_data.password_element); 203 form->password_element = WideToUTF16(form_data.password_element);
204 if (form_data.username_value) { 204 if (form_data.username_value) {
205 form->username_value = WideToUTF16(form_data.username_value); 205 form->username_value = WideToUTF16(form_data.username_value);
206 form->display_name = form->username_value;
207 form->is_zero_click = true;
206 if (form_data.password_value) 208 if (form_data.password_value)
207 form->password_value = WideToUTF16(form_data.password_value); 209 form->password_value = WideToUTF16(form_data.password_value);
208 } else { 210 } else {
209 form->blacklisted_by_user = true; 211 form->blacklisted_by_user = true;
210 } 212 }
213 form->avatar_url = GURL("http://accounts.google.com/Avatar");
214 form->federation_url = GURL("http://accounts.google.com/login");
Mike West 2014/08/18 18:52:11 Nit: HTTPS throughout. :)
vasilii 2014/08/20 11:45:34 Done.
211 return form; 215 return form;
212 } 216 }
213 217
214 // Macro to simplify calling CheckFormsAgainstExpectations with a useful label. 218 // Macro to simplify calling CheckFormsAgainstExpectations with a useful label.
215 #define CHECK_FORMS(forms, expectations, i) \ 219 #define CHECK_FORMS(forms, expectations, i) \
216 CheckFormsAgainstExpectations(forms, expectations, #forms, i) 220 CheckFormsAgainstExpectations(forms, expectations, #forms, i)
217 221
218 // Ensures that the data in |forms| match |expectations|, causing test failures 222 // Ensures that the data in |forms| match |expectations|, causing test failures
219 // for any discrepencies. 223 // for any discrepencies.
220 // TODO(stuartmorgan): This is current order-dependent; ideally it shouldn't 224 // TODO(stuartmorgan): This is current order-dependent; ideally it shouldn't
(...skipping 22 matching lines...) Expand all
243 EXPECT_EQ(GURL(expectation->action), form->action) << test_label; 247 EXPECT_EQ(GURL(expectation->action), form->action) << test_label;
244 EXPECT_EQ(WideToUTF16(expectation->submit_element), form->submit_element) 248 EXPECT_EQ(WideToUTF16(expectation->submit_element), form->submit_element)
245 << test_label; 249 << test_label;
246 EXPECT_EQ(WideToUTF16(expectation->username_element), 250 EXPECT_EQ(WideToUTF16(expectation->username_element),
247 form->username_element) << test_label; 251 form->username_element) << test_label;
248 EXPECT_EQ(WideToUTF16(expectation->password_element), 252 EXPECT_EQ(WideToUTF16(expectation->password_element),
249 form->password_element) << test_label; 253 form->password_element) << test_label;
250 if (expectation->username_value) { 254 if (expectation->username_value) {
251 EXPECT_EQ(WideToUTF16(expectation->username_value), 255 EXPECT_EQ(WideToUTF16(expectation->username_value),
252 form->username_value) << test_label; 256 form->username_value) << test_label;
257 EXPECT_EQ(WideToUTF16(expectation->username_value),
258 form->display_name) << test_label;
259 EXPECT_TRUE(form->is_zero_click) << test_label;
253 EXPECT_EQ(WideToUTF16(expectation->password_value), 260 EXPECT_EQ(WideToUTF16(expectation->password_value),
254 form->password_value) << test_label; 261 form->password_value) << test_label;
255 } else { 262 } else {
256 EXPECT_TRUE(form->blacklisted_by_user) << test_label; 263 EXPECT_TRUE(form->blacklisted_by_user) << test_label;
257 } 264 }
258 EXPECT_EQ(expectation->preferred, form->preferred) << test_label; 265 EXPECT_EQ(expectation->preferred, form->preferred) << test_label;
259 EXPECT_EQ(expectation->ssl_valid, form->ssl_valid) << test_label; 266 EXPECT_EQ(expectation->ssl_valid, form->ssl_valid) << test_label;
260 EXPECT_DOUBLE_EQ(expectation->creation_time, 267 EXPECT_DOUBLE_EQ(expectation->creation_time,
261 form->date_created.ToDoubleT()) << test_label; 268 form->date_created.ToDoubleT()) << test_label;
262 base::Time created = base::Time::FromDoubleT(expectation->creation_time); 269 base::Time created = base::Time::FromDoubleT(expectation->creation_time);
263 EXPECT_EQ(created + base::TimeDelta::FromDays(1), 270 EXPECT_EQ(created + base::TimeDelta::FromDays(1),
264 form->date_synced) << test_label; 271 form->date_synced) << test_label;
272 EXPECT_EQ(GURL("http://accounts.google.com/Avatar"), form->avatar_url);
273 EXPECT_EQ(GURL("http://accounts.google.com/login"), form->federation_url);
265 } 274 }
266 } 275 }
267 276
268 #pragma mark - 277 #pragma mark -
269 278
270 TEST_F(PasswordStoreMacInternalsTest, TestKeychainToFormTranslation) { 279 TEST_F(PasswordStoreMacInternalsTest, TestKeychainToFormTranslation) {
271 typedef struct { 280 typedef struct {
272 const PasswordForm::Scheme scheme; 281 const PasswordForm::Scheme scheme;
273 const char* signon_realm; 282 const char* signon_realm;
274 const char* origin; 283 const char* origin;
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 ASSERT_EQ(1u, matching_items.size()); 1453 ASSERT_EQ(1u, matching_items.size());
1445 EXPECT_EQ(ASCIIToUTF16("joe_user"), matching_items[0]->username_value); 1454 EXPECT_EQ(ASCIIToUTF16("joe_user"), matching_items[0]->username_value);
1446 matching_items.clear(); 1455 matching_items.clear();
1447 1456
1448 // Check the third-party password is still there. 1457 // Check the third-party password is still there.
1449 owned_keychain_adapter.SetFindsOnlyOwnedItems(false); 1458 owned_keychain_adapter.SetFindsOnlyOwnedItems(false);
1450 matching_items.get() = owned_keychain_adapter.PasswordsFillingForm( 1459 matching_items.get() = owned_keychain_adapter.PasswordsFillingForm(
1451 "http://some.domain.com/insecure.html", PasswordForm::SCHEME_HTML); 1460 "http://some.domain.com/insecure.html", PasswordForm::SCHEME_HTML);
1452 ASSERT_EQ(1u, matching_items.size()); 1461 ASSERT_EQ(1u, matching_items.size());
1453 } 1462 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698