• David Van Cleve's avatar
    Trust Tokens: Refactor signing tests to verify more expectations in test · fd8fbd63
    David Van Cleve authored
    Right now, a lot of the postcondition verification for the Trust Tokens
    browser tests covering request signing takes place in the test helper,
    network::test::TrustTokenRequestHandler. In particular, right now, the
    helper provides an interface that allows callers to extract the last
    signing request verification error, if any. This has a couple problems:
      1. Callers can't distinguish cases where no signing request arrived in
      the handler from cases where a signing request was successfully
      processed
      2. All of the postcondition checking takes place in the handler, so
      it's hard to modify the postcondition checking to reflect changes in
      test expectations. Right now, we do this by passing an options
      struct to the handler, but it woul be more readable if we could
      express the expectations in real time, after sending the request, in
      the main browser test code.
    
    This CL refactors the test handler to instead allow callers to extract
    a representation of the most recently received signed request, if any.
    Callers can then check postconditions directly against this data, using
    trust_tokens/test/ helper methods.
    
    Fixed: 1126276
    Change-Id: Ic6d9f403c2175cc5bb7c2a3ff59ffc575252cda3
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2520200
    Commit-Queue: David Van Cleve <davidvc@chromium.org>
    Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
    Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#825103}
    fd8fbd63
trust_token_browsertest.cc 55.8 KB