OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_MOCK_ADDRESS_VALIDATOR_H_ | |
6 #define CHROME_BROWSER_UI_AUTOFILL_MOCK_ADDRESS_VALIDATOR_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include "base/macros.h" | |
11 #include "testing/gmock/include/gmock/gmock.h" | |
12 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" | |
13 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da
ta.h" | |
14 | |
15 namespace autofill { | |
16 | |
17 MATCHER_P(CountryCodeMatcher, country_code, "Checks an AddressData's country") { | |
18 // |arg| is an AddressData object. | |
19 return arg.region_code == country_code; | |
20 } | |
21 | |
22 class MockAddressValidator : public AddressValidator { | |
23 public: | |
24 MockAddressValidator(); | |
25 virtual ~MockAddressValidator(); | |
26 | |
27 MOCK_METHOD1(LoadRules, void(const std::string& country_code)); | |
28 | |
29 MOCK_CONST_METHOD3(ValidateAddress, | |
30 AddressValidator::Status( | |
31 const ::i18n::addressinput::AddressData& address, | |
32 const ::i18n::addressinput::FieldProblemMap* filter, | |
33 ::i18n::addressinput::FieldProblemMap* problems)); | |
34 | |
35 MOCK_CONST_METHOD4(GetSuggestions, | |
36 AddressValidator::Status( | |
37 const ::i18n::addressinput::AddressData& user_input, | |
38 ::i18n::addressinput::AddressField focused_field, | |
39 size_t suggestions_limit, | |
40 std::vector< ::i18n::addressinput::AddressData>* suggestions)); | |
41 | |
42 MOCK_CONST_METHOD1(CanonicalizeAdministrativeArea, | |
43 bool(::i18n::addressinput::AddressData* address_data)); | |
44 | |
45 private: | |
46 DISALLOW_COPY_AND_ASSIGN(MockAddressValidator); | |
47 }; | |
48 | |
49 } // namespace autofill | |
50 | |
51 #endif // CHROME_BROWSER_UI_AUTOFILL_MOCK_ADDRESS_VALIDATOR_H_ | |
OLD | NEW |