| Index: chrome/test/chromedriver/session_commands.cc
|
| diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc
|
| index 9af15c3a49f51164d7b480df0a1c6d5f13448759..b403124f5d63c31e8d49df11e8063f586ff47d0d 100644
|
| --- a/chrome/test/chromedriver/session_commands.cc
|
| +++ b/chrome/test/chromedriver/session_commands.cc
|
| @@ -356,6 +356,20 @@ Status ExecuteSwitchToWindow(
|
| return status;
|
| }
|
|
|
| + if (session->overridden_network_conditions) {
|
| + WebView* web_view;
|
| + status = session->chrome->GetWebViewById(web_view_id, &web_view);
|
| + if (status.IsError())
|
| + return status;
|
| + status = web_view->ConnectIfNecessary();
|
| + if (status.IsError())
|
| + return status;
|
| + status = web_view->OverrideNetworkConditions(
|
| + *session->overridden_network_conditions);
|
| + if (status.IsError())
|
| + return status;
|
| + }
|
| +
|
| session->window = web_view_id;
|
| session->SwitchToTopFrame();
|
| session->mouse_position = WebPoint(0, 0);
|
| @@ -456,6 +470,29 @@ Status ExecuteGetLocation(
|
| return Status(kOk);
|
| }
|
|
|
| +Status ExecuteGetNetworkConditions(
|
| + Session* session,
|
| + const base::DictionaryValue& params,
|
| + scoped_ptr<base::Value>* value) {
|
| + if (!session->overridden_network_conditions) {
|
| + return Status(kUnknownError,
|
| + "network conditions must be set before it can be retrieved");
|
| + }
|
| + base::DictionaryValue conditions;
|
| + conditions.SetBoolean("offline",
|
| + session->overridden_network_conditions->offline);
|
| + conditions.SetInteger("latency",
|
| + session->overridden_network_conditions->latency);
|
| + conditions.SetInteger(
|
| + "download_throughput",
|
| + session->overridden_network_conditions->download_throughput);
|
| + conditions.SetInteger(
|
| + "upload_throughput",
|
| + session->overridden_network_conditions->upload_throughput);
|
| + value->reset(conditions.DeepCopy());
|
| + return Status(kOk);
|
| +}
|
| +
|
| Status ExecuteGetWindowPosition(
|
| Session* session,
|
| const base::DictionaryValue& params,
|
|
|