Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: components/payments/core/test_address_normalizer.h

Issue 2836353002: [Payments] Normalize shipping address change on Desktop (Closed)
Patch Set: Fixed Deps Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/payments/core/test_address_normalizer.h
diff --git a/components/payments/core/test_address_normalizer.h b/components/payments/core/test_address_normalizer.h
new file mode 100644
index 0000000000000000000000000000000000000000..56def89de361b49ad596fdc8acd54a7735e3772a
--- /dev/null
+++ b/components/payments/core/test_address_normalizer.h
@@ -0,0 +1,46 @@
+// 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.
+
+#ifndef COMPONENTS_PAYMENTS_CORE_TEST_ADDRESS_NORMALIZER_H_
+#define COMPONENTS_PAYMENTS_CORE_TEST_ADDRESS_NORMALIZER_H_
+
+#include "components/payments/core/address_normalizer.h"
+
+#include "components/autofill/core/browser/autofill_profile.h"
+
+namespace payments {
+
+// A simpler version of the address normalizer to be used in tests. Can be set
+// to normalize instantaneously or to wait for a call.
+class TestAddressNormalizer : public AddressNormalizer {
+ public:
+ TestAddressNormalizer() {}
+
+ void LoadRulesForRegion(const std::string& region_code) override {}
+
+ bool AreRulesLoadedForRegion(const std::string& region_code) override;
+
+ void StartAddressNormalization(
+ const autofill::AutofillProfile& profile,
+ const std::string& region_code,
+ int timeout_seconds,
+ AddressNormalizer::Delegate* requester) override;
+
+ void OnAddressValidationRulesLoaded(const std::string& region_code,
+ bool success) override {}
+
+ void DelayNormalization();
+
+ void CompleteAddressNormalization();
+
+ private:
+ autofill::AutofillProfile profile_;
+ AddressNormalizer::Delegate* requester_;
+
+ bool instantaneous_normalization_ = true;
+};
+
+} // namespace payments
+
+#endif // COMPONENTS_PAYMENTS_CORE_TEST_ADDRESS_NORMALIZER_H_

Powered by Google App Engine
This is Rietveld 408576698