Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/origin_trials/javascript-insert-token.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/origin_trials/javascript-insert-token.html b/third_party/WebKit/LayoutTests/http/tests/origin_trials/javascript-insert-token.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cf68f5f25baec9f5dd894306d26b20b39b97d3f7 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/origin_trials/javascript-insert-token.html |
| @@ -0,0 +1,34 @@ |
| +<!DOCTYPE html> |
| +<meta charset="utf-8"> |
| +<!-- TODO(iclelland): Generate this sample token during the build. The token |
|
iclelland
2016/03/31 15:00:00
The comment is still valid; should probably be in
|
| + 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. --> |
| +<script> |
| +var meta = document.createElement('meta'); |
| +meta.setAttribute('http-equiv', 'origin-trial'); |
| +meta.setAttribute('content', '1|tZPW/JJ2Sxm4z7k/Eb1/upMsppozWpTwEuGwhgQko0zWS6ebvjQ+EXPP/ftoMX8/PCoDgOS3xlrXElMgDDvbCg==|http://127.0.0.1:8000|Frobulate|2000000000'); |
| +document.head.appendChild(meta); |
|
iclelland
2016/03/31 15:00:00
Can we define these four lines as a function here
Marijn Kruisselbrink
2016/04/01 23:54:47
Not done yet. I'm not sure if it really gains us m
iclelland
2016/04/05 17:26:28
I think we should share code -- definitely the opa
Marijn Kruisselbrink
2016/04/05 20:56:08
There are still multiple copies of the opaque toke
|
| +</script> |
| +<title>Test Sample API when trial is enabled</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharness-helpers.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="resources/origin_trials.js"></script> |
| +<script> |
| + |
| +// The trial is not enabled by the token above, because it was inserted by |
| +// javascript. |
| +expect_failure(); |
| + |
| +var after_load_test = async_test("Testing async"); |
| +addEventListener('load', () => { |
| + var meta = document.createElement('meta'); |
| + meta.setAttribute('http-equiv', 'origin-trial'); |
| + meta.setAttribute('content', '1|tZPW/JJ2Sxm4z7k/Eb1/upMsppozWpTwEuGwhgQko0zWS6ebvjQ+EXPP/ftoMX8/PCoDgOS3xlrXElMgDDvbCg==|http://127.0.0.1:8000|Frobulate|2000000000'); |
| + document.head.appendChild(meta); |
| + assert_idl_attribute(window.internals, 'frobulate'); |
|
iclelland
2016/03/31 15:00:00
Can this be replaced with a call to expect_failure
Marijn Kruisselbrink
2016/03/31 19:01:48
Not really. expect_failure() creates new tests rat
iclelland
2016/04/01 15:19:09
Maybe factoring the common code out into a named f
Marijn Kruisselbrink
2016/04/01 23:54:47
I changed expect_failure to optionally accept a te
|
| + assert_throws("NotSupportedError", () => { window.internals.frobulate; }, |
| + 'Accessing attribute should throw error'); |
| + after_load_test.done(); |
| + }); |
| +</script> |