• Mustafa Emre Acer's avatar
    Default omnibox navigations to https: Add tests for redirects · ba7c5031
    Mustafa Emre Acer authored
    This CL adds a test case where the upgraded HTTPS URL redirects to
    another HTTPS URL. The test simply checks if an upgraded HTTPS URL
    that redirects to another good HTTPS URL successfully loads and records
    a histogram entry.
    
    There are additional interesting cases involving redirects, however
    it's not yet fully clear how the feature should behave in those cases.
    For example, an upgraded HTTPS URL could redirect to a broken HTTPS URL.
    It's TBD whether this should fall back to HTTP or not. For that
    reason, these cases aren't yet tested.
    
    Presently, the autocomplete code does the upgrade from HTTP to HTTPS and
    it only upgrades URLs with default ports. As a result, browser tests
    need to use URLs with default ports, so they use
    URLLoaderInterceptor instead of EmbeddedTestServer.
    (URLLoaderInterceptor can return responses for URLs with a default
    port (e.g. https://example.com) whereas EmbeddedTestServer can't.)
    
    I wasn't able to simulate a redirect using URLLoaderInterceptor, so
    this CL modifies the autocomplete code to accept a non-default port as
    well. It also adds a new test class that uses EmbeddedTestServer to
    serve the http and https URLs. The rest of the browser tests are
    unchanged and still use URLLoaderInterceptor so that the codepath that
    uses the default ports is still exercised.
    
    Bug: 1141691
    Change-Id: Ic0d0638758bf457fad508ef028144681a7034cbe
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2621964
    Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
    Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
    Reviewed-by: default avatarChris Thompson <cthomp@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#845054}
    ba7c5031
autocomplete_input.h 14.1 KB