Skip to content

Commit

Permalink
Add consume_user_activation() to testdriver.js
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed Nov 28, 2022
1 parent 4435c35 commit dee0b8f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions resources/testdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,28 @@
set_spc_transaction_mode: function(mode, context=null) {
return window.test_driver_internal.set_spc_transaction_mode(mode, context);
},

/**
* Consumes the user activation
*
* Matches the `Consume User Activation of Window
* <https://w3c.github.io/permissions/#consume-user-activation-of-window>`
* WebDriver command.
*
* Which corresponds to these steps in HTML:
* https://html.spec.whatwg.org/#consume-user-activation
*
* @example
* await test_driver.consume_user_activation();
* await test_driver.consume_user_activation(iframe.contentWindow);
*
* @param {WindowProxy?} [context=null] - Browsing context in which to run the
* call.
* @returns {Promise<boolean>} fulfilled when user activation is consumed.
*/
consume_user_activation(context=null) {
return window.test_driver_internal.consume_user_activation(context);
},
};

window.test_driver_internal = {
Expand Down Expand Up @@ -774,5 +796,11 @@
return Promise.reject(new Error("unimplemented"));
},

async consume_user_activation () {
if (this.in_automation) {
throw new Error('Not implemented');
}
},

};
})();

0 comments on commit dee0b8f

Please sign in to comment.