summaryrefslogtreecommitdiff
path: root/chromium/components/payments/core/test_address_normalizer.cc
blob: e0b9fc868e892885c8b3f55a90083c7abc579d4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/payments/core/test_address_normalizer.h"

namespace payments {

bool TestAddressNormalizer::AreRulesLoadedForRegion(
    const std::string& region_code) {
  return true;
}

void TestAddressNormalizer::StartAddressNormalization(
    const autofill::AutofillProfile& profile,
    const std::string& region_code,
    int timeout_seconds,
    AddressNormalizer::Delegate* requester) {
  if (instantaneous_normalization_) {
    requester->OnAddressNormalized(profile);
    return;
  }

  // Setup the necessary variables for the delayed normalization.
  profile_ = profile;
  requester_ = requester;
}

void TestAddressNormalizer::DelayNormalization() {
  instantaneous_normalization_ = false;
}

void TestAddressNormalizer::CompleteAddressNormalization() {
  DCHECK(instantaneous_normalization_ == false);
  requester_->OnAddressNormalized(profile_);
}

}  // namespace payments