• Dominic Farolino's avatar
    Add cross-origin main resource prefetch + SplitCache tests · 56e10760
    Dominic Farolino authored
    This CL adds prefetch browsertests for main-resources, and subresources to
    ensure that the main-resource implementation doesn't break SplitCache. The
    tests all run with the SplitCacheByNetworkIsolationKey feature enabled
    to prepare for the implementation of Cross-origin Prefetch + SplitCache.
    The scenarios tested are as follow:
    
     - Cross-origin as=document prefetch reuse as top-level-navigation
        - This tests that the cross-origin resource is cached with a
          NetworkIsolationKey corresponding to its origin. Therefore, it can
          be reused for top-level-navigations
     - Cross-origin as=document prefetch not reused as cross-origin subresource
        - This tests that even though cross-origin as=document prefetches are
          cached under an atypical NetworkIsolationKey, their reuse is
          restricted to top-level-navigations.
     - Cross-origin prefetch subresources are not able to be reused from cache
       in a cross-origin context. (AKA, we didn't break SplitCache).
     - Cross-origin prefetch subresources are able to be reused by the frame
       that fetched them. (AKA, we still didn't break SplitCache).
     - Cross-origin prefetch subresources not reused as top-level navigations
        - As the comment in the code suggests, even though this is safe, a
          resource must be committed to a single cache partition. Therefore, if
          a cross-origin subresource is prefetched, it cannot be used anywhere
          else but in the frame that fetched it.
    
    R=kinuko@chromium.org, yhirano@chromium.org
    
    Bug: 939317
    Change-Id: Ie50844463a838c5fabd5a153cd0caf720a59da4a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1732869
    Commit-Queue: Dominic Farolino <dom@chromium.org>
    Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
    Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#684319}
    56e10760
prefetch_browsertest.cc 35 KB