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

Side by Side Diff: third_party/WebKit/LayoutTests/webshare/resources/mock-share-service.js

Issue 2219383002: Require a user gesture to use navigator.share. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webshare-dictionary
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webshare/share-arity.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 'use strict'; 1 'use strict';
2 2
3 let mockShareService = loadMojoModules( 3 let mockShareService = loadMojoModules(
4 'mockShareService', 4 'mockShareService',
5 ['mojo/public/js/router', 5 ['mojo/public/js/router',
6 'third_party/WebKit/public/platform/modules/webshare/webshare.mojom', 6 'third_party/WebKit/public/platform/modules/webshare/webshare.mojom',
7 ]).then(mojo => { 7 ]).then(mojo => {
8 let [router, webshare] = mojo.modules; 8 let [router, webshare] = mojo.modules;
9 9
10 class MockShareService extends webshare.ShareService.stubClass { 10 class MockShareService extends webshare.ShareService.stubClass {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 return new MockShareService(mojo.frameInterfaces); 58 return new MockShareService(mojo.frameInterfaces);
59 }); 59 });
60 60
61 function share_test(func, name, properties) { 61 function share_test(func, name, properties) {
62 promise_test(t => mockShareService.then(mock => { 62 promise_test(t => mockShareService.then(mock => {
63 let mockPromise = mock.init_(); 63 let mockPromise = mock.init_();
64 return Promise.race([func(t, mock), mockPromise]); 64 return Promise.race([func(t, mock), mockPromise]);
65 }), name, properties); 65 }), name, properties);
66 } 66 }
67
68 // Copied from resources/bluetooth/bluetooth-helpers.js.
69 function callWithKeyDown(functionCalledOnKeyPress) {
70 return new Promise(resolve => {
71 function onKeyPress() {
72 document.removeEventListener('keypress', onKeyPress, false);
73 resolve(functionCalledOnKeyPress());
74 }
75 document.addEventListener('keypress', onKeyPress, false);
76
77 eventSender.keyDown(' ', []);
78 });
79 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webshare/share-arity.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698