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

Side by Side Diff: net/quic/chromium/mock_network_change_notifier.h

Issue 2811183003: Change Cronet's "disable_ipv6" to "disable_ipv6_on_wifi" (Closed)
Patch Set: more comments Created 3 years, 8 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
« no previous file with comments | « net/dns/mapped_host_resolver.cc ('k') | net/quic/chromium/mock_network_change_notifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_
6 #define NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_
7
8 #include "net/base/network_change_notifier.h"
9
10 namespace net {
11 namespace test {
12
13 class MockNetworkChangeNotifier : public NetworkChangeNotifier {
14 public:
15 MockNetworkChangeNotifier();
16 ~MockNetworkChangeNotifier() override;
17
18 ConnectionType GetCurrentConnectionType() const override;
19
20 void ForceNetworkHandlesSupported();
21
22 bool AreNetworkHandlesCurrentlySupported() const override;
23
24 void SetConnectionType(ConnectionType connection_type) {
25 connection_type_ = connection_type;
26 }
27
28 void SetConnectedNetworksList(const NetworkList& network_list);
29
30 void GetCurrentConnectedNetworks(NetworkList* network_list) const override;
31
32 // Delivers a MADE_DEFAULT notification to observers.
33 void NotifyNetworkMadeDefault(NetworkChangeNotifier::NetworkHandle network);
34
35 // Queues a MADE_DEFAULT notification to be delivered to observers
36 // but does not spin the message loop to actually deliver it.
37 void QueueNetworkMadeDefault(NetworkChangeNotifier::NetworkHandle network);
38
39 // Delivers a DISCONNECTED notification to observers.
40 void NotifyNetworkDisconnected(NetworkChangeNotifier::NetworkHandle network);
41
42 // Queues a DISCONNECTED notification to be delivered to observers
43 // but does not spin the message loop to actually deliver it.
44 void QueueNetworkDisconnected(NetworkChangeNotifier::NetworkHandle network);
45
46 // Delivers a CONNECTED notification to observers.
47 void NotifyNetworkConnected(NetworkChangeNotifier::NetworkHandle network);
48
49 private:
50 bool force_network_handles_supported_;
51 ConnectionType connection_type_;
52 NetworkChangeNotifier::NetworkList connected_networks_;
53 };
54
55 // Class to replace existing NetworkChangeNotifier singleton with a
56 // MockNetworkChangeNotifier for a test. To use, simply create a
57 // ScopedMockNetworkChangeNotifier object in the test.
58 class ScopedMockNetworkChangeNotifier {
59 public:
60 ScopedMockNetworkChangeNotifier();
61 ~ScopedMockNetworkChangeNotifier();
62
63 MockNetworkChangeNotifier* mock_network_change_notifier();
64
65 private:
66 std::unique_ptr<NetworkChangeNotifier::DisableForTest>
67 disable_network_change_notifier_for_tests_;
68 std::unique_ptr<MockNetworkChangeNotifier> mock_network_change_notifier_;
69 };
70
71 } // namespace test
72 } // namespace net
73
74 #endif // NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « net/dns/mapped_host_resolver.cc ('k') | net/quic/chromium/mock_network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698