Index: components/password_manager/core/browser/password_manager_test_utils.h |
diff --git a/components/password_manager/core/browser/password_manager_test_utils.h b/components/password_manager/core/browser/password_manager_test_utils.h |
index 71599a446b8a0dfab35e83201e9b1c91741b5fd1..ce6f6d252528b225931ac1b306aa92398e3677a1 100644 |
--- a/components/password_manager/core/browser/password_manager_test_utils.h |
+++ b/components/password_manager/core/browser/password_manager_test_utils.h |
@@ -5,6 +5,7 @@ |
#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_H_ |
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_H_ |
+#include <iosfwd> |
#include <vector> |
#include "base/memory/scoped_ptr.h" |
@@ -42,17 +43,18 @@ struct PasswordFormData { |
scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromDataForTesting( |
const PasswordFormData& form_data); |
-// Checks whether two vectors of PasswordForms contain equivalent elements, |
-// regardless of order. |
-// TODO(vabr) The *Ptr suffix is obsolete, rename. |
-bool ContainsSamePasswordFormsPtr( |
- const std::vector<autofill::PasswordForm*>& first, |
- const std::vector<autofill::PasswordForm*>& second); |
- |
-// This gmock matcher is used to check that the |arg| contains exactly the same |
-// PasswordForms as |forms|, regardless of order. |
-MATCHER_P(ContainsSamePasswordForms, forms, "") { |
- return ContainsSamePasswordFormsPtr(forms, arg); |
+// Checks whether the PasswordForms pointed to in |actual_values| are in some |
+// permutation pairwise equal to those in |expectations|. Returns true in case |
+// of a perfect match; otherwise returns false and writes details of mismatches |
+// in human readable format to |mismatches_output| unless it is null. |
+bool ContainsEqualPasswordFormsUnordered( |
+ const std::vector<autofill::PasswordForm*>& expectations, |
+ const std::vector<autofill::PasswordForm*>& actual_values, |
+ std::ostream* mismatches_output); |
+ |
+MATCHER_P(UnorderedPasswordFormElementsAre, expectations, "") { |
+ return ContainsEqualPasswordFormsUnordered(expectations, arg, |
+ result_listener->stream()); |
} |
} // namespace password_manager |