Chromium Code Reviews| Index: chrome/test/chromedriver/chrome/network_conditions_override_manager.h |
| diff --git a/chrome/test/chromedriver/chrome/network_conditions_override_manager.h b/chrome/test/chromedriver/chrome/network_conditions_override_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8e59f221c6e96fde150fc7335e6c58685c40b59f |
| --- /dev/null |
| +++ b/chrome/test/chromedriver/chrome/network_conditions_override_manager.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_TEST_CHROMEDRIVER_CHROME_NETWORK_CONDITIONS_OVERRIDE_MANAGER_H_ |
| +#define CHROME_TEST_CHROMEDRIVER_CHROME_NETWORK_CONDITIONS_OVERRIDE_MANAGER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/test/chromedriver/chrome/devtools_event_listener.h" |
| + |
| +namespace base { |
| +class DictionaryValue; |
| +} |
| + |
| +class DevToolsClient; |
| +struct NetworkConditions; |
| +class Status; |
| + |
| +// Overrides the network conditions, if requested, for the duration of the |
| +// given |DevToolsClient|'s lifetime. |
| +class NetworkConditionsOverrideManager : public DevToolsEventListener { |
| + public: |
| + explicit NetworkConditionsOverrideManager(DevToolsClient* client); |
| + ~NetworkConditionsOverrideManager() override; |
| + |
| + Status OverrideNetworkConditions(const NetworkConditions& network_conditions); |
| + |
| + // Overridden from DevToolsEventListener: |
| + Status OnConnected(DevToolsClient* client) override; |
| + Status OnEvent(DevToolsClient* client, |
| + const std::string& method, |
| + const base::DictionaryValue& params) override; |
| + |
| + private: |
| + Status ApplyOverrideIfNeeded(); |
| + |
| + DevToolsClient* client_; |
| + scoped_ptr<NetworkConditions> overridden_network_conditions_; |
|
samuong
2015/02/11 23:22:14
Does NetworkConditionsOverrideManager need to make
srawlins
2015/02/25 22:40:57
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkConditionsOverrideManager); |
| +}; |
| + |
| +#endif // CHROME_TEST_CHROMEDRIVER_CHROME_NETWORK_CONDITIONS_OVERRIDE_MANAGER_H_ |