Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/test/chromedriver/chrome/network_conditions_override_manager.h

Issue 883083002: [chromedriver] Add Network Conditions Override Manager and tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a filtered-out offline test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_NETWORK_CONDITIONS_OVERRIDE_MANAGER_H_
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_NETWORK_CONDITIONS_OVERRIDE_MANAGER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
14
15 namespace base {
16 class DictionaryValue;
17 }
18
19 class DevToolsClient;
20 struct NetworkConditions;
21 class Status;
22
23 // Overrides the network conditions, if requested, for the duration of the
24 // given |DevToolsClient|'s lifetime.
25 class NetworkConditionsOverrideManager : public DevToolsEventListener {
26 public:
27 explicit NetworkConditionsOverrideManager(DevToolsClient* client);
28 ~NetworkConditionsOverrideManager() override;
29
30 Status OverrideNetworkConditions(const NetworkConditions& network_conditions);
31
32 // Overridden from DevToolsEventListener:
33 Status OnConnected(DevToolsClient* client) override;
34 Status OnEvent(DevToolsClient* client,
35 const std::string& method,
36 const base::DictionaryValue& params) override;
37
38 private:
39 Status ApplyOverrideIfNeeded();
40 Status ApplyOverride(const NetworkConditions* network_conditions);
41
42 DevToolsClient* client_;
43 const NetworkConditions* overridden_network_conditions_;
44
45 DISALLOW_COPY_AND_ASSIGN(NetworkConditionsOverrideManager);
46 };
47
48 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_NETWORK_CONDITIONS_OVERRIDE_MANAGER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698