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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLoggerTest.java

Issue 2455513004: [Payments] Fix the Payment Request histogram check failure in tests. (Closed)
Patch Set: Addressed comments Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 package org.chromium.chrome.browser.payments; 5 package org.chromium.chrome.browser.payments;
6 6
7 import android.content.DialogInterface; 7 import android.content.DialogInterface;
8 import android.test.suitebuilder.annotation.MediumTest; 8 import android.test.suitebuilder.annotation.MediumTest;
9 9
10 import org.chromium.base.metrics.RecordHistogram; 10 import org.chromium.base.metrics.RecordHistogram;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 0, RecordHistogram.getHistogramValueCountForTesting( 292 0, RecordHistogram.getHistogramValueCountForTesting(
293 "PaymentRequest.NumberOfSuggestionsShown.ContactInfo. Completed", 2)); 293 "PaymentRequest.NumberOfSuggestionsShown.ContactInfo. Completed", 2));
294 assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( 294 assertEquals(0, RecordHistogram.getHistogramValueCountForTesting(
295 "PaymentRequest.NumberOfSelectionAdds.ContactInf o.Completed", 0)); 295 "PaymentRequest.NumberOfSelectionAdds.ContactInf o.Completed", 0));
296 assertEquals( 296 assertEquals(
297 0, RecordHistogram.getHistogramValueCountForTesting( 297 0, RecordHistogram.getHistogramValueCountForTesting(
298 "PaymentRequest.NumberOfSelectionChanges.ContactInfo. Completed", 0)); 298 "PaymentRequest.NumberOfSelectionChanges.ContactInfo. Completed", 0));
299 assertEquals(0, RecordHistogram.getHistogramValueCountForTesting( 299 assertEquals(0, RecordHistogram.getHistogramValueCountForTesting(
300 "PaymentRequest.NumberOfSelectionEdits.ContactIn fo.Completed", 0)); 300 "PaymentRequest.NumberOfSelectionEdits.ContactIn fo.Completed", 0));
301 } 301 }
302
303 /**
304 * Expect that that the journey metrics are logged correctly on a second con secutive payment
305 * request.
306 */
307 @MediumTest
308 @Feature({"Payments"})
309 public void testTwoTimes() throws InterruptedException, ExecutionException, TimeoutException {
310 // Complete a Payment Request with a credit card.
311 triggerUIAndWait("ccBuy", mReadyToPay);
312 clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
313 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo Unmask);
314 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed );
315
316 // Make sure the right number of suggestions were logged.
317 assertEquals(
318 1, RecordHistogram.getHistogramValueCountForTesting(
319 "PaymentRequest.NumberOfSuggestionsShown.ShippingAddr ess.Completed", 2));
320
321 // Make sure no adds, edits or changes were logged.
322 assertEquals(
323 1, RecordHistogram.getHistogramValueCountForTesting(
324 "PaymentRequest.NumberOfSelectionAdds.ShippingAddress .Completed", 0));
325 assertEquals(
326 1, RecordHistogram.getHistogramValueCountForTesting(
327 "PaymentRequest.NumberOfSelectionChanges.ShippingAddr ess.Completed", 0));
328 assertEquals(
329 1, RecordHistogram.getHistogramValueCountForTesting(
330 "PaymentRequest.NumberOfSelectionEdits.ShippingAddres s.Completed", 0));
331
332 // Complete a second Payment Request with a credit card.
333 reTriggerUIAndWait("ccBuy", mReadyToPay);
334 clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
335 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo Unmask);
336 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed );
337
338 // Make sure the right number of suggestions were logged.
339 assertEquals(
340 2, RecordHistogram.getHistogramValueCountForTesting(
341 "PaymentRequest.NumberOfSuggestionsShown.ShippingAddr ess.Completed", 2));
342
343 // Make sure no adds, edits or changes were logged.
344 assertEquals(
345 2, RecordHistogram.getHistogramValueCountForTesting(
346 "PaymentRequest.NumberOfSelectionAdds.ShippingAddress .Completed", 0));
347 assertEquals(
348 2, RecordHistogram.getHistogramValueCountForTesting(
349 "PaymentRequest.NumberOfSelectionChanges.ShippingAddr ess.Completed", 0));
350 assertEquals(
351 2, RecordHistogram.getHistogramValueCountForTesting(
352 "PaymentRequest.NumberOfSelectionEdits.ShippingAddres s.Completed", 0));
353 }
302 } 354 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698