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

Side by Side Diff: components/payments/core/journey_logger.cc

Issue 2805913002: [Payments] Move JourneyLogger unit tests from Java to C++. (Closed)
Patch Set: Addressed Math's comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/payments/core/journey_logger.h" 5 #include "components/payments/core/journey_logger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/histogram_functions.h" 9 #include "base/metrics/histogram_functions.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 169
170 void JourneyLogger::RecordCanMakePaymentEffectOnShow() { 170 void JourneyLogger::RecordCanMakePaymentEffectOnShow() {
171 if (!was_can_make_payments_used_) 171 if (!was_can_make_payments_used_)
172 return; 172 return;
173 173
174 int effect_on_show = 0; 174 int effect_on_show = 0;
175 if (was_show_called_) 175 if (was_show_called_)
176 effect_on_show |= CMP_SHOW_DID_SHOW; 176 effect_on_show |= CMP_SHOW_DID_SHOW;
177 if (could_make_payment_) 177 if (could_make_payment_)
178 effect_on_show |= CMP_SHOW_COULD_MAKE_PAYMENT_; 178 effect_on_show |= CMP_SHOW_COULD_MAKE_PAYMENT;
179 179
180 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Used.EffectOnShow", 180 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Used.EffectOnShow",
181 effect_on_show, CMP_SHOW_MAX); 181 effect_on_show, CMP_SHOW_MAX);
182 } 182 }
183 183
184 void JourneyLogger::RecordCanMakePaymentEffectOnCompletion( 184 void JourneyLogger::RecordCanMakePaymentEffectOnCompletion(
185 CompletionStatus completion_status) { 185 CompletionStatus completion_status) {
186 if (!was_show_called_) 186 if (!was_show_called_)
187 return; 187 return;
188 188
189 std::string histogram_name = "PaymentRequest.CanMakePayment."; 189 std::string histogram_name = "PaymentRequest.CanMakePayment.";
190 if (!was_can_make_payments_used_) { 190 if (!was_can_make_payments_used_) {
191 histogram_name += "NotUsed.WithShowEffectOnCompletion"; 191 histogram_name += "NotUsed.WithShowEffectOnCompletion";
192 } else if (could_make_payment_) { 192 } else if (could_make_payment_) {
193 histogram_name += "Used.TrueWithShowEffectOnCompletion"; 193 histogram_name += "Used.TrueWithShowEffectOnCompletion";
194 } else { 194 } else {
195 histogram_name += "Used.FalseWithShowEffectOnCompletion"; 195 histogram_name += "Used.FalseWithShowEffectOnCompletion";
196 } 196 }
197 197
198 base::UmaHistogramEnumeration(histogram_name, completion_status, 198 base::UmaHistogramEnumeration(histogram_name, completion_status,
199 COMPLETION_STATUS_MAX); 199 COMPLETION_STATUS_MAX);
200 } 200 }
201 201
202 } // namespace payments 202 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/core/journey_logger.h ('k') | components/payments/core/journey_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698