Chromium Code Reviews| 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 8d1577315d062f3249934595df2f22a8bbe85b4c..32fd2dc9f2b8499bb189abf79b230535b69e80f3 100644 |
| --- a/components/password_manager/core/browser/password_manager_test_utils.h |
| +++ b/components/password_manager/core/browser/password_manager_test_utils.h |
| @@ -6,12 +6,14 @@ |
| #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_H_ |
| #include <iosfwd> |
| +#include <string> |
| #include <vector> |
| #include "base/feature_list.h" |
| #include "base/memory/ref_counted.h" |
| #include "components/autofill/core/common/password_form.h" |
| #include "components/password_manager/core/browser/password_store.h" |
| +#include "net/http/transport_security_state.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| namespace password_manager { |
| @@ -59,6 +61,11 @@ struct PasswordFormData { |
| std::unique_ptr<autofill::PasswordForm> CreatePasswordFormFromDataForTesting( |
| const PasswordFormData& form_data); |
| +// Convenience method that wraps the passed in forms in unique ptrs and returns |
| +// the result. |
| +std::vector<std::unique_ptr<autofill::PasswordForm>> WrapForms( |
| + const std::vector<autofill::PasswordForm>& forms); |
|
jdoerrie
2017/03/28 13:18:41
This is very generic and possibly could even be ma
vabr (Chromium)
2017/03/28 13:39:11
I would say keep it specialised until you need it
|
| + |
| // 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 |
| @@ -92,6 +99,21 @@ class MockPasswordReuseDetectorConsumer : public PasswordReuseDetectorConsumer { |
| void(const base::string16&, const std::string&, int, int)); |
| }; |
| +// Auxiliary class to automatically set and reset the HSTS state for a given |
| +// host. |
| +class HSTSStateManager { |
| + public: |
| + HSTSStateManager(net::TransportSecurityState* state, |
| + bool is_hsts, |
| + const std::string& host); |
| + ~HSTSStateManager(); |
| + |
| + private: |
| + net::TransportSecurityState* state_; |
| + const bool is_hsts_; |
| + const std::string host_; |
| +}; |
| + |
|
jdoerrie
2017/03/28 13:18:41
Not quite sure whether it is appropriate to includ
vabr (Chromium)
2017/03/28 13:39:11
Looks fine to me. While this whole file is again a
|
| } // namespace password_manager |
| #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_H_ |