| OLD | NEW |
| 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 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
| 6 | 6 |
| 7 import android.support.test.InstrumentationRegistry; | 7 import android.support.test.InstrumentationRegistry; |
| 8 import android.support.test.filters.SmallTest; | 8 import android.support.test.filters.SmallTest; |
| 9 | 9 |
| 10 import org.junit.Assert; | 10 import org.junit.Assert; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 444 |
| 445 // There should be a record for a completion when CanMakePayment is true
and the PR is shown | 445 // There should be a record for a completion when CanMakePayment is true
and the PR is shown |
| 446 // to the user. | 446 // to the user. |
| 447 Assert.assertEquals(1, | 447 Assert.assertEquals(1, |
| 448 RecordHistogram.getHistogramValueCountForTesting( | 448 RecordHistogram.getHistogramValueCountForTesting( |
| 449 "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOn
Completion", | 449 "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOn
Completion", |
| 450 JourneyLogger.COMPLETION_STATUS_COMPLETED)); | 450 JourneyLogger.COMPLETION_STATUS_COMPLETED)); |
| 451 } | 451 } |
| 452 | 452 |
| 453 /** | 453 /** |
| 454 * Tests the canMakePayment metrics are not logged if the Payment Request wa
s done in an |
| 455 * incognito tab. |
| 456 */ |
| 457 @Test |
| 458 @SmallTest |
| 459 @Feature({"Payments"}) |
| 460 public void testRecordJourneyStatsHistograms_CanMakePayment_IncognitoTab() { |
| 461 JourneyLogger logger = new JourneyLogger(); |
| 462 assertNoLogForCanMakePayment(); |
| 463 |
| 464 // The user is in an incognito tab so CanMakePayment is always true; |
| 465 logger.setShowCalled(); |
| 466 logger.setIsIncognito(); |
| 467 logger.setCanMakePaymentValue(true); |
| 468 logger.recordJourneyStatsHistograms(JourneyLogger.COMPLETION_STATUS_COMP
LETED); |
| 469 |
| 470 // There should be no CanMakePayment metrics logged. |
| 471 assertNoLogForCanMakePayment(); |
| 472 } |
| 473 |
| 474 /** |
| 454 * Tests that the completion status metrics based on whether the user had su
ggestions for all | 475 * Tests that the completion status metrics based on whether the user had su
ggestions for all |
| 455 * the requested sections are logged as correctly. | 476 * the requested sections are logged as correctly. |
| 456 */ | 477 */ |
| 457 @Test | 478 @Test |
| 458 @SmallTest | 479 @SmallTest |
| 459 @Feature({"Payments"}) | 480 @Feature({"Payments"}) |
| 460 public void testRecordJourneyStatsHistograms_SuggestionsForEverything_Comple
ted() { | 481 public void testRecordJourneyStatsHistograms_SuggestionsForEverything_Comple
ted() { |
| 461 JourneyLogger logger = new JourneyLogger(); | 482 JourneyLogger logger = new JourneyLogger(); |
| 462 | 483 |
| 463 // Simulate that the user had suggestions for all the requested sections
. | 484 // Simulate that the user had suggestions for all the requested sections
. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 RecordHistogram.getHistogramValueCountForTesting( | 718 RecordHistogram.getHistogramValueCountForTesting( |
| 698 "PaymentRequest.CanMakePayment.Used.TrueWithShowEffe
ctOnCompletion", | 719 "PaymentRequest.CanMakePayment.Used.TrueWithShowEffe
ctOnCompletion", |
| 699 i)); | 720 i)); |
| 700 Assert.assertEquals(0, | 721 Assert.assertEquals(0, |
| 701 RecordHistogram.getHistogramValueCountForTesting( | 722 RecordHistogram.getHistogramValueCountForTesting( |
| 702 "PaymentRequest.CanMakePayment.Used.FalseWithShowEff
ectOnCompletion", | 723 "PaymentRequest.CanMakePayment.Used.FalseWithShowEff
ectOnCompletion", |
| 703 i)); | 724 i)); |
| 704 } | 725 } |
| 705 } | 726 } |
| 706 } | 727 } |
| OLD | NEW |