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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added-before-access.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added-before-access.html b/third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added-before-access.html
new file mode 100644
index 0000000000000000000000000000000000000000..7d049cac63d71e6c231842738dc44e7fce127a49
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/origin_trials/sample-api-script-added-before-access.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test Sample API when trial is enabled by script-added meta tag, without touching the objects</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";
+
+// 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.
+// the case where the target object(s) do not exist when the trial is enabled.
+
+// 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
+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>

Powered by Google App Engine
This is Rietveld 408576698