Chromium Code Reviews| Index: chrome/test/chromedriver/window_commands.cc |
| diff --git a/chrome/test/chromedriver/window_commands.cc b/chrome/test/chromedriver/window_commands.cc |
| index 000cec03670647e38e5bf3c0d4cfef30c4c99916..51ae0706a8b0d835b5fd87dd10b83ecdada4831e 100644 |
| --- a/chrome/test/chromedriver/window_commands.cc |
| +++ b/chrome/test/chromedriver/window_commands.cc |
| @@ -930,6 +930,29 @@ Status ExecuteSetNetworkConditions( |
| *session->overridden_network_conditions); |
| } |
| +Status ExecuteDeleteNetworkConditions( |
| + Session* session, |
| + WebView* web_view, |
| + const base::DictionaryValue& params, |
| + scoped_ptr<base::Value>* value) { |
| + // Chrome does not have any command to stop overriding network conditions, so |
| + // we just override the network conditions with the "No throttling" preset. |
| + NetworkConditions* network_conditions = new NetworkConditions(); |
|
samuong
2015/03/23 20:23:45
Won't this leak? Why not allocate on the stack?
|
| + // Get conditions from preset list. |
| + Status status = FindPresetNetwork("No throttling", network_conditions); |
| + if (status.IsError()) |
| + return status; |
| + |
| + status = web_view->OverrideNetworkConditions(*network_conditions); |
| + if (status.IsError()) |
| + return status; |
| + |
| + // After we've successfully overridden the network conditions with |
| + // "No throttling", we can delete them from |session|. |
| + session->overridden_network_conditions.reset(); |
| + return status; |
| +} |
| + |
| Status ExecuteTakeHeapSnapshot( |
| Session* session, |
| WebView* web_view, |