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

Unified Diff: LayoutTests/http/tests/permissions/resources/helpers.js

Issue 760223003: Stub implementation of Permissions API module. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix win compile Created 6 years 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/permissions/resources/test-api-surface.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/permissions/resources/helpers.js
diff --git a/LayoutTests/http/tests/permissions/resources/helpers.js b/LayoutTests/http/tests/permissions/resources/helpers.js
new file mode 100644
index 0000000000000000000000000000000000000000..59c5a99189cfec0f7a6168d885fe6ec1b69d06eb
--- /dev/null
+++ b/LayoutTests/http/tests/permissions/resources/helpers.js
@@ -0,0 +1,42 @@
+// This file is using testharness.js coding style.
+
+function get_script_href()
+{
+ var filename = window.location.href.substr(window.location.href.lastIndexOf('/') + 1);
+ return 'resources/' + filename.replace('.html', '.js');
+}
+
+function get_current_scope()
+{
+ if ('document' in self) {
+ return 'Window';
+ }
+ if ('DedicatedWorkerGlobalScope' in self &&
+ self instanceof DedicatedWorkerGlobalScope) {
+ return 'DedicatedWorker';
+ }
+ if ('SharedWorkerGlobalScope' in self &&
+ self instanceof SharedWorkerGlobalScope) {
+ return 'SharedWorker';
+ }
+ if ('ServiceWorkerGlobalScope' in self &&
+ self instanceof ServiceWorkerGlobalScope) {
+ return 'ServiceWorker';
+ }
+
+ throw new Error('unknown scope');
+}
+
+function run_test() {
+ var script_href = get_script_href();
+
+ // Run the tests on the Window scope.
+ var script_element = document.createElement('script');
+ script_element.src = script_href;
+ document.body.appendChild(script_element);
+
+ // Run the tests on {Dedicated,Shared,Service}Worker.
+ fetch_tests_from_worker(new Worker(script_href));
+ fetch_tests_from_worker(new SharedWorker(script_href));
+ window.service_worker_test(script_href);
+}
« no previous file with comments | « no previous file | LayoutTests/http/tests/permissions/resources/test-api-surface.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698