Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added-before-access.html

Issue 2640823004: Allow origin trials to be enabled by script (Closed)
Patch Set: Add tracking of installed features Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <title>Test Sample API when trial is enabled by script-added meta tag, without t ouching the objects</title>
4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 <script src="resources/origin_trials.js"></script>
7 <script>
8
9 // TODO(iclelland): Generate this sample token during the build. The token
10 // below will expire in 2033, but it would be better to always have a token wh ich
11 // is guaranteed to be valid when the tests are run. -->
12 // Generate this token with the command:
13 // generate_token.py http://127.0.0.1:8000 Frobulate -expire-timestamp=200000000 0
14 var token = "AlCoOPbezqtrGMzSzbLQC4c+oPqO6yuioemcBPjgcXajF8jtmZr4B8tJRPAARPbsX6h DeVyXCKHzEJfpBXvZgQEAAABReyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR 1cmUiOiAiRnJvYnVsYXRlIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9";
15
16 // Do not access the target object(s) before adding the token. This is to test
iclelland 2017/01/20 14:31:19 The target object in this case is the value return
chasej 2017/01/25 19:58:20 Done.
17 // the case where the target object(s) do not exist when the trial is enabled.
18
19 // Add the token to enable the trial
iclelland 2017/01/20 14:31:19 We could factor this out into origin_trials.js, ma
chasej 2017/01/25 19:58:20 I factored this out into a function, but it's not
iclelland 2017/01/26 20:14:11 Yes, that's what I meant -- the DOM node to append
20 var tokenElement = document.createElement('meta');
21 tokenElement.httpEquiv = "origin-trial";
22 tokenElement.content = token;
23 document.head.appendChild(tokenElement);
24
25 // The trial is now enabled, by the token added via script.
26 expect_success();
27
28 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698