| <!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-helper.js"></script> |
| <script src="resources/origintrials.js"></script> |
| <script> |
| |
| // TODO(iclelland): Generate these sample tokens 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 these tokens with the given commands. |
| // generate_token.py http://127.0.0.1:8000 FrobulateImplied --expire-timestamp=2000000000 |
| var implied_token = "AlCoOPbezqtrGMzSzbLQC4c+oPqO6yuioemcBPjgcXajF8jtmZr4B8tJRPAARPbsX6hDeVyXCKHzEJfpBXvZgQEAAABReyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiRnJvYnVsYXRlIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9"; |
| // generate_token.py http://127.0.0.1:8000 Frobulate --expire-timestamp=2000000000 |
| var implied_by_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 |
| // token is added below. |
| var skip_worker = true; |
| expect_failure_implied(skip_worker); |
| |
| // Add the implied token to enable the trial. |
| OriginTrialsHelper.add_token(implied_token); |
| |
| // The trial is now enabled, by the token added via script. |
| expect_success_implied(); |
| |
| // Add a token to enable the trial which implies the trial. |
| // - This should effectively be a no-op. |
| OriginTrialsHelper.add_token(implied_by_token); |
| |
| // The implied trial should remain enabled, as well as having the other trial |
| // enabled. |
| // - Skip the worker tests, as they will cause duplicate test names and just |
| // interested in a sanity test for the implied trial remaining enabled. |
| expect_success(); |
| expect_success_implied(' when enabled again by implied_by trial', true); |
| |
| </script> |