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 set command-line |feature|. It |appends_to_list| of | |
Bernhard Bauer
2016/02/11 11:12:40
Nit: The description of the |appends_to_list| para
Pritam Nikam
2016/02/25 14:16:06
Done.
| |
78 // --enable-features if |set_enabled| is set to true; otherwise to that of | |
79 // --disable-features. | |
80 void EnableFeature(const base::Feature& feature, | |
81 bool set_enabled, | |
82 bool appends_to_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 |