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

Side by Side Diff: net/base/network_change_notifier.h

Issue 1255263002: Remove a race around NetworkChangeNotifier::test_notifications_only_ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Possible iOS fix Created 5 years, 4 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 | « content/browser/net_info_browsertest.cc ('k') | net/base/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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 // Allow unit tests to trigger notifications. 306 // Allow unit tests to trigger notifications.
307 static void NotifyObserversOfIPAddressChangeForTests(); 307 static void NotifyObserversOfIPAddressChangeForTests();
308 static void NotifyObserversOfConnectionTypeChangeForTests( 308 static void NotifyObserversOfConnectionTypeChangeForTests(
309 ConnectionType type); 309 ConnectionType type);
310 static void NotifyObserversOfNetworkChangeForTests(ConnectionType type); 310 static void NotifyObserversOfNetworkChangeForTests(ConnectionType type);
311 static void NotifyObserversOfInitialDNSConfigReadForTests(); 311 static void NotifyObserversOfInitialDNSConfigReadForTests();
312 312
313 // Enable or disable notifications from the host. After setting to true, be 313 // Enable or disable notifications from the host. After setting to true, be
314 // sure to pump the RunLoop until idle to finish any preexisting 314 // sure to pump the RunLoop until idle to finish any preexisting
315 // notifications. 315 // notifications. To use this, it must must be called before a
316 // NetworkChangeNotifier is created.
316 static void SetTestNotificationsOnly(bool test_only); 317 static void SetTestNotificationsOnly(bool test_only);
317 318
318 // Return a string equivalent to |type|. 319 // Return a string equivalent to |type|.
319 static const char* ConnectionTypeToString(ConnectionType type); 320 static const char* ConnectionTypeToString(ConnectionType type);
320 321
321 // Let the NetworkChangeNotifier know we received some data. 322 // Let the NetworkChangeNotifier know we received some data.
322 // This is used for producing histogram data about the accuracy of 323 // This is used for producing histogram data about the accuracy of
323 // the NetworkChangenotifier's online detection and rough network 324 // the NetworkChangenotifier's online detection and rough network
324 // connection measurements. 325 // connection measurements.
325 static void NotifyDataReceived(const URLRequest& request, int bytes_read); 326 static void NotifyDataReceived(const URLRequest& request, int bytes_read);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 // The current network state. Hosts DnsConfig, exposed via GetDnsConfig. 445 // The current network state. Hosts DnsConfig, exposed via GetDnsConfig.
445 scoped_ptr<NetworkState> network_state_; 446 scoped_ptr<NetworkState> network_state_;
446 447
447 // A little-piggy-back observer that simply logs UMA histogram data. 448 // A little-piggy-back observer that simply logs UMA histogram data.
448 scoped_ptr<HistogramWatcher> histogram_watcher_; 449 scoped_ptr<HistogramWatcher> histogram_watcher_;
449 450
450 // Computes NetworkChange signal from IPAddress and ConnectionType signals. 451 // Computes NetworkChange signal from IPAddress and ConnectionType signals.
451 scoped_ptr<NetworkChangeCalculator> network_change_calculator_; 452 scoped_ptr<NetworkChangeCalculator> network_change_calculator_;
452 453
453 // Set true to disable non-test notifications (to prevent flakes in tests). 454 // Set true to disable non-test notifications (to prevent flakes in tests).
454 bool test_notifications_only_; 455 static bool test_notifications_only_;
455 456
456 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 457 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
457 }; 458 };
458 459
459 } // namespace net 460 } // namespace net
460 461
461 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 462 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « content/browser/net_info_browsertest.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698