Skip to content

Commit

Permalink
[COOP] Use /set-headers? in test instead of specific files.
Browse files Browse the repository at this point in the history
There are 4 headers:
- Cross-Origin-Opener-Policy: 3 values.
- Cross-Origin-Opener-Policy-Report-Only: 3 values.
- Cross-Origin-Embedder-Policy: 2 values.
- Cross-Origin-Embedder-Policy-Report-Only: 2 values.

I was asked to produces tests about the different configurations. There
are up to 24 possibilities.

Currently, we are producing a new test file for every combinaison, like:
page_with_coop_and_coep.html{,mock-http-headers}

If we want to test further, the number of files is going to grow
quickly. Moreover we would have to produce very complex name:
page_with_coop_ro_same_origin_allow_opener_coop_same_origin_coep.html

It would be better if we could specify the headers to use in tests. This
is possible thanks to the "/set-headers?" handler.
The file above can be replaced by the path:
  "/set-headers?"
  "Cross-Origin-Opener-Policy: same-origin-allow-popups&"
  "Cross-Origin-Opener-Policy-Report-Only: same-origin&"
  "Cross-Origin-EmbedderPolicy: require-corp"

This is much more readable and flexible.

This patch deletes all the current files we have and use "/set-header?"
instead.

Bug: chromium:1090273
Change-Id: I67195f0940c4bb1a873014fe69c49321dcf76774
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2279803
Reviewed-by: Pâris Meuleman <pmeuleman@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785693}
  • Loading branch information
ArthurSonzogni authored and Commit Bot committed Jul 7, 2020
1 parent 8bcfaef commit 52f1fe4
Show file tree
Hide file tree
Showing 9 changed files with 233 additions and 118 deletions.
327 changes: 233 additions & 94 deletions content/browser/cross_origin_opener_policy_browsertest.cc

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions content/test/data/page_with_coop_and_coep.html

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions content/test/data/page_with_coop_ro_and_coep.html

This file was deleted.

This file was deleted.

0 comments on commit 52f1fe4

Please sign in to comment.