• Rouslan Solomakhin's avatar
    [Web Payment] Avoid crash when cancelling payment · baa1d649
    Rouslan Solomakhin authored
    Before this patch, canceling payment while in an Android payment app
    would post an asynchronous task to dereference a callback and then
    synchronously set the callback to null. The asynchronous task then
    encountered a null pointer exception.
    
    This patch sets the callback to null only after it has been invoked and
    adds a unit test to avoid future regressions. The patch moves Android
    intent interactions that used to go through WindowAndroid into a new
    abstraction "Launcher", because Mockito is unable to mock WindowAndroid
    on KitKat.
    
    After this patch, cancelling payment while in an Android payment app
    does not encounter a null pointer exception.
    
    Bug: 1072793
    Change-Id: I2068feb9b741dce3c5ecb11088d79d2cb37e3bb6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2158913
    Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
    Auto-Submit: Rouslan Solomakhin <rouslan@chromium.org>
    Reviewed-by: default avatarMohamed Heikal <mheikal@chromium.org>
    Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#763865}
    baa1d649
android_payment_app_unittest.cc 760 Bytes