Merge pull request #6935 from electron/default-network-conditions

Default network conditions to 0.0
This commit is contained in:
Cheng Zhao 2016-08-23 16:40:36 +09:00 committed by GitHub
commit 4ca6587660
2 changed files with 9 additions and 5 deletions

View file

@ -416,7 +416,7 @@ void Session::SetDownloadPath(const base::FilePath& path) {
void Session::EnableNetworkEmulation(const mate::Dictionary& options) { void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
std::unique_ptr<brightray::DevToolsNetworkConditions> conditions; std::unique_ptr<brightray::DevToolsNetworkConditions> conditions;
bool offline = false; bool offline = false;
double latency, download_throughput, upload_throughput; double latency = 0.0, download_throughput = 0.0, upload_throughput = 0.0;
if (options.Get("offline", &offline) && offline) { if (options.Get("offline", &offline) && offline) {
conditions.reset(new brightray::DevToolsNetworkConditions(offline)); conditions.reset(new brightray::DevToolsNetworkConditions(offline));
} else { } else {

View file

@ -212,10 +212,14 @@ Sets download saving directory. By default, the download directory will be the
#### `ses.enableNetworkEmulation(options)` #### `ses.enableNetworkEmulation(options)`
* `options` Object * `options` Object
* `offline` Boolean - Whether to emulate network outage. * `offline` Boolean (optional) - Whether to emulate network outage. Defaults
* `latency` Double - RTT in ms to false.
* `downloadThroughput` Double - Download rate in Bps * `latency` Double (optional) - RTT in ms. Defaults to 0 which will disable
* `uploadThroughput` Double - Upload rate in Bps latency throttling.
* `downloadThroughput` Double (optional) - Download rate in Bps. Defaults to 0
which will disable download throttling.
* `uploadThroughput` Double (optional) - Upload rate in Bps. Defaults to 0
which will disable upload throttling.
Emulates network with the given configuration for the `session`. Emulates network with the given configuration for the `session`.