aboutsummaryrefslogtreecommitdiff
path: root/node_modules/selenium-webdriver/chrome.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-24 15:10:37 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-24 15:11:17 +0200
commit7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch)
tree70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/selenium-webdriver/chrome.js
parentaca1143cb9eed16cf37f04e475e4257418dd18ac (diff)
downloadwallet-core-7a3df06eb573d36142bd1a8e03c5ce8752d300b3.tar.xz
fix build issues and add typedoc
Diffstat (limited to 'node_modules/selenium-webdriver/chrome.js')
-rw-r--r--node_modules/selenium-webdriver/chrome.js49
1 files changed, 48 insertions, 1 deletions
diff --git a/node_modules/selenium-webdriver/chrome.js b/node_modules/selenium-webdriver/chrome.js
index 2dbc93351..b1e8a29e4 100644
--- a/node_modules/selenium-webdriver/chrome.js
+++ b/node_modules/selenium-webdriver/chrome.js
@@ -143,7 +143,9 @@ const CHROMEDRIVER_EXE =
* @enum {string}
*/
const Command = {
- LAUNCH_APP: 'launchApp'
+ LAUNCH_APP: 'launchApp',
+ GET_NETWORK_CONDITIONS: 'getNetworkConditions',
+ SET_NETWORK_CONDITIONS: 'setNetworkConditions'
};
@@ -169,6 +171,14 @@ function configureExecutor(executor) {
Command.LAUNCH_APP,
'POST',
'/session/:sessionId/chromium/launch_app');
+ executor.defineCommand(
+ Command.GET_NETWORK_CONDITIONS,
+ 'GET',
+ '/session/:sessionId/chromium/network_conditions');
+ executor.defineCommand(
+ Command.SET_NETWORK_CONDITIONS,
+ 'POST',
+ '/session/:sessionId/chromium/network_conditions');
}
@@ -727,6 +737,43 @@ class Driver extends webdriver.WebDriver {
new command.Command(Command.LAUNCH_APP).setParameter('id', id),
'Driver.launchApp()');
}
+
+ /**
+ * Schedules a command to get Chrome network emulation settings.
+ * @return {!promise.Thenable<T>} A promise that will be resolved
+ * when network emulation settings are retrievied.
+ */
+ getNetworkConditions() {
+ return this.schedule(
+ new command.Command(Command.GET_NETWORK_CONDITIONS),
+ 'Driver.getNetworkConditions()');
+ }
+
+ /**
+ * Schedules a command to set Chrome network emulation settings.
+ *
+ * __Sample Usage:__
+ *
+ * driver.setNetworkConditions({
+ * offline: false,
+ * latency: 5, // Additional latency (ms).
+ * download_throughput: 500 * 1024, // Maximal aggregated download throughput.
+ * upload_throughput: 500 * 1024 // Maximal aggregated upload throughput.
+ * });
+ *
+ * @param {Object} spec Defines the network conditions to set
+ * @return {!promise.Thenable<void>} A promise that will be resolved
+ * when network emulation settings are set.
+ */
+ setNetworkConditions(spec) {
+ if (!spec || typeof spec !== 'object') {
+ throw TypeError('setNetworkConditions called with non-network-conditions parameter');
+ }
+
+ return this.schedule(
+ new command.Command(Command.SET_NETWORK_CONDITIONS).setParameter('network_conditions', spec),
+ 'Driver.setNetworkConditions(' + JSON.stringify(spec) + ')');
+ }
}