OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/feature_list.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "components/autofill/core/common/password_form.h" | 13 #include "components/autofill/core/common/password_form.h" |
13 #include "components/password_manager/core/browser/password_store.h" | 14 #include "components/password_manager/core/browser/password_store.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
15 | 16 |
16 namespace password_manager { | 17 namespace password_manager { |
17 | 18 |
18 // This template allows creating methods with signature conforming to | 19 // This template allows creating methods with signature conforming to |
19 // TestingFactoryFunction of the appropriate platform instance of | 20 // TestingFactoryFunction of the appropriate platform instance of |
20 // KeyedServiceFactory. Context is the browser context prescribed by | 21 // KeyedServiceFactory. Context is the browser context prescribed by |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool ContainsEqualPasswordFormsUnordered( | 67 bool ContainsEqualPasswordFormsUnordered( |
67 const std::vector<autofill::PasswordForm*>& expectations, | 68 const std::vector<autofill::PasswordForm*>& expectations, |
68 const std::vector<autofill::PasswordForm*>& actual_values, | 69 const std::vector<autofill::PasswordForm*>& actual_values, |
69 std::ostream* mismatches_output); | 70 std::ostream* mismatches_output); |
70 | 71 |
71 MATCHER_P(UnorderedPasswordFormElementsAre, expectations, "") { | 72 MATCHER_P(UnorderedPasswordFormElementsAre, expectations, "") { |
72 return ContainsEqualPasswordFormsUnordered(expectations, arg, | 73 return ContainsEqualPasswordFormsUnordered(expectations, arg, |
73 result_listener->stream()); | 74 result_listener->stream()); |
74 } | 75 } |
75 | 76 |
| 77 // Helper function to initialize feature overrides via command-line flags |
| 78 // supplied as |enable_features| and |disable_features| using the |
| 79 // |feature_list|. |
| 80 void SetFeatures(const std::vector<const base::Feature*>& enable_features, |
| 81 const std::vector<const base::Feature*>& disable_features, |
| 82 scoped_ptr<base::FeatureList> feature_list); |
| 83 |
76 class MockPasswordStoreObserver : public PasswordStore::Observer { | 84 class MockPasswordStoreObserver : public PasswordStore::Observer { |
77 public: | 85 public: |
78 MockPasswordStoreObserver(); | 86 MockPasswordStoreObserver(); |
79 ~MockPasswordStoreObserver() override; | 87 ~MockPasswordStoreObserver() override; |
80 | 88 |
81 MOCK_METHOD1(OnLoginsChanged, void(const PasswordStoreChangeList& changes)); | 89 MOCK_METHOD1(OnLoginsChanged, void(const PasswordStoreChangeList& changes)); |
82 }; | 90 }; |
83 | 91 |
84 } // namespace password_manager | 92 } // namespace password_manager |
85 | 93 |
86 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_
H_ | 94 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_TEST_UTILS_
H_ |
OLD | NEW |