Commit 8612d596 authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

Follow up on payments::JourneyLogger's events_ bit vector validation.

This cl validates a few more bits which were missing in the original
validation cl:
https://chromium-review.googlesource.com/c/chromium/src/+/1611640

Bug: 962998
Change-Id: Ie905914eca9f75dcdc856e258ccbfd235b04bdc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1631709
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664359}
parent b382e98f
......@@ -841,7 +841,7 @@ void PaymentRequestBrowserTestBase::EnableSkipUIForForBasicCard() {
GetPaymentRequests(GetActiveWebContents());
ASSERT_EQ(1U, requests.size());
requests.front()
->SetSkipUiForNonUrlPaymentMethodIdentifiersForTest();
->set_skip_ui_for_non_url_payment_method_identifiers_for_test();
}
} // namespace payments
......
......@@ -628,11 +628,6 @@ bool PaymentRequest::IsIncognito() const {
return delegate_->IsIncognito();
}
void PaymentRequest::SetSkipUiForNonUrlPaymentMethodIdentifiersForTest() {
journey_logger_.set_skip_ui_for_non_url_payment_method_identifiers_for_test();
skip_ui_for_non_url_payment_method_identifiers_for_test_ = true;
}
void PaymentRequest::RecordFirstAbortReason(
JourneyLogger::AbortReason abort_reason) {
if (!has_recorded_completion_) {
......
......@@ -117,7 +117,9 @@ class PaymentRequest : public mojom::PaymentRequest,
// Allow to skip UI into payment handlers for such payment methods as
// "basic-card". Used only in tests.
void SetSkipUiForNonUrlPaymentMethodIdentifiersForTest();
void set_skip_ui_for_non_url_payment_method_identifiers_for_test() {
skip_ui_for_non_url_payment_method_identifiers_for_test_ = true;
}
content::WebContents* web_contents() { return web_contents_; }
......
......@@ -319,12 +319,21 @@ void JourneyLogger::ValidateEventBits() const {
bit_vector.clear();
}
// Basic card flow should not skip UI show unless explicitly specified for
// tests.
if (events_ & EVENT_SELECTED_CREDIT_CARD) {
DCHECK((events_ & EVENT_SHOWN) ||
skip_ui_for_non_url_payment_method_identifiers_for_test_);
// Validate skipped UI show.
if (events_ & EVENT_SKIPPED_SHOW) {
// Built in autofill payment handler for basic card should not skip UI show.
DCHECK(!(events_ & EVENT_SELECTED_CREDIT_CARD));
// Payment sheet should not get skipped when any of the following info is
// required.
DCHECK(!(events_ & EVENT_REQUEST_SHIPPING));
DCHECK(!(events_ & EVENT_REQUEST_PAYER_NAME));
DCHECK(!(events_ & EVENT_REQUEST_PAYER_EMAIL));
DCHECK(!(events_ & EVENT_REQUEST_PAYER_PHONE));
}
// Check that the two bits are not set at the same time.
DCHECK(!(events_ & EVENT_CAN_MAKE_PAYMENT_TRUE) ||
!(events_ & EVENT_CAN_MAKE_PAYMENT_FALSE));
}
bool JourneyLogger::WasPaymentRequestTriggered() {
......
......@@ -185,10 +185,6 @@ class JourneyLogger {
// reason.
void SetNotShown(NotShownReason reason);
void set_skip_ui_for_non_url_payment_method_identifiers_for_test() {
skip_ui_for_non_url_payment_method_identifiers_for_test_ = true;
}
private:
static const int NUMBER_OF_SECTIONS = 3;
......@@ -241,7 +237,6 @@ class JourneyLogger {
SectionStats sections_[NUMBER_OF_SECTIONS];
bool has_recorded_ = false;
bool is_incognito_;
bool skip_ui_for_non_url_payment_method_identifiers_for_test_ = false;
// Accumulates the many events that have happened during the Payment Request.
int events_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment