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

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

Issue 10885019: Fix for failing unit tests PasswordStoreDefaultTest.* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change only the method we copy the vector into a set Created 8 years, 3 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
« no previous file with comments | « build/android/gtest_filter/unit_tests_disabled ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/password_manager/password_form_data.h" 7 #include "chrome/browser/password_manager/password_form_data.h"
8 8
9 using webkit::forms::PasswordForm; 9 using webkit::forms::PasswordForm;
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 << "date_created: " << form.date_created.ToDoubleT(); 69 << "date_created: " << form.date_created.ToDoubleT();
70 } 70 }
71 71
72 typedef std::set<const webkit::forms::PasswordForm*> SetOfForms; 72 typedef std::set<const webkit::forms::PasswordForm*> SetOfForms;
73 73
74 bool ContainsSamePasswordFormsPtr( 74 bool ContainsSamePasswordFormsPtr(
75 const std::vector<PasswordForm*>& first, 75 const std::vector<PasswordForm*>& first,
76 const std::vector<PasswordForm*>& second) { 76 const std::vector<PasswordForm*>& second) {
77 if (first.size() != second.size()) 77 if (first.size() != second.size())
78 return false; 78 return false;
79 SetOfForms expectations(first.begin(), first.end()); 79 SetOfForms expectations;
80 std::copy(first.begin(), first.end(), std::inserter(expectations,
81 expectations.begin()));
Ilya Sherman 2012/08/29 22:53:51 nit: Please add a comment documenting why this is
Ramya 2012/08/29 23:01:34 Done.
80 for (unsigned int i = 0; i < second.size(); ++i) { 82 for (unsigned int i = 0; i < second.size(); ++i) {
81 const PasswordForm* actual = second[i]; 83 const PasswordForm* actual = second[i];
82 bool found_match = false; 84 bool found_match = false;
83 for (SetOfForms::iterator it = expectations.begin(); 85 for (SetOfForms::iterator it = expectations.begin();
84 it != expectations.end(); ++it) { 86 it != expectations.end(); ++it) {
85 const PasswordForm* expected = *it; 87 const PasswordForm* expected = *it;
86 if (*expected == *actual) { 88 if (*expected == *actual) {
87 found_match = true; 89 found_match = true;
88 expectations.erase(it); 90 expectations.erase(it);
89 break; 91 break;
(...skipping 13 matching lines...) Expand all
103 std::vector<PasswordForm*> first_ptr; 105 std::vector<PasswordForm*> first_ptr;
104 for (unsigned int i = 0; i < first.size(); ++i) { 106 for (unsigned int i = 0; i < first.size(); ++i) {
105 first_ptr.push_back(&first[i]); 107 first_ptr.push_back(&first[i]);
106 } 108 }
107 std::vector<PasswordForm*> second_ptr; 109 std::vector<PasswordForm*> second_ptr;
108 for (unsigned int i = 0; i < second.size(); ++i) { 110 for (unsigned int i = 0; i < second.size(); ++i) {
109 second_ptr.push_back(&second[i]); 111 second_ptr.push_back(&second[i]);
110 } 112 }
111 return ContainsSamePasswordFormsPtr(first_ptr, second_ptr); 113 return ContainsSamePasswordFormsPtr(first_ptr, second_ptr);
112 } 114 }
OLDNEW
« no previous file with comments | « build/android/gtest_filter/unit_tests_disabled ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698