Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added.html b/third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..73cfda01e53ba701056b7add1137a76e6426f11f |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added.html |
| @@ -0,0 +1,31 @@ |
| +<!DOCTYPE html> |
| +<meta charset="utf-8"> |
| +<title>Test Sample API when trial is enabled by script-added meta tag</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="resources/origin_trials.js"></script> |
| +<script> |
| + |
| +// TODO(iclelland): Generate this sample token during the build. The token |
| +// below will expire in 2033, but it would be better to always have a token which |
| +// is guaranteed to be valid when the tests are run. --> |
| +// Generate this token with the command: |
| +// generate_token.py http://127.0.0.1:8000 Frobulate -expire-timestamp=2000000000 |
| +var token = "AlCoOPbezqtrGMzSzbLQC4c+oPqO6yuioemcBPjgcXajF8jtmZr4B8tJRPAARPbsX6hDeVyXCKHzEJfpBXvZgQEAAABReyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiRnJvYnVsYXRlIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9"; |
| + |
| +// The trial is not enabled, as no token is provided. |
| +// - Skip the worker tests, as they will likely fail due to running after the |
|
iclelland
2017/01/20 14:31:19
Can we chain these tests, so that the worker tests
chasej
2017/01/25 19:58:20
I looked into that, but wasn't able to find a simp
|
| +// token is added below. |
| +var skip_worker = true; |
| +expect_failure(skip_worker); |
| + |
| +// Add the token to enable the trial |
| +var tokenElement = document.createElement('meta'); |
| +tokenElement.httpEquiv = "origin-trial"; |
| +tokenElement.content = token; |
| +document.head.appendChild(tokenElement); |
| + |
| +// The trial is now enabled, by the token added via script. |
| +expect_success(); |
| + |
| +</script> |