Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / autofill / mock_address_validator.h
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 "base/basictypes.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h"
11 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_validator.h"
12
13 namespace autofill {
14
15 MATCHER_P(CountryCodeMatcher, country_code, "Checks an AddressData's country") {
16   // |arg| is an AddressData object.
17   return arg.country_code == country_code;
18 }
19
20 class MockAddressValidator : public ::i18n::addressinput::AddressValidator {
21  public:
22   MockAddressValidator();
23   virtual ~MockAddressValidator();
24
25   MOCK_METHOD1(LoadRules, void(const std::string& country_code));
26
27   MOCK_CONST_METHOD3(ValidateAddress,
28       ::i18n::addressinput::AddressValidator::Status(
29           const ::i18n::addressinput::AddressData& address,
30           const ::i18n::addressinput::AddressProblemFilter& filter,
31           ::i18n::addressinput::AddressProblems* problems));
32
33   MOCK_CONST_METHOD1(CanonicalizeAdministrativeArea,
34                      bool(::i18n::addressinput::AddressData* address_data));
35
36  private:
37   DISALLOW_COPY_AND_ASSIGN(MockAddressValidator);
38 };
39
40 }  // namespace autofill
41
42 #endif  // CHROME_BROWSER_UI_AUTOFILL_MOCK_ADDRESS_VALIDATOR_H_