Chromium Code Reviews| Index: content/browser/background_sync/background_sync_network_observer.h |
| diff --git a/content/browser/background_sync/background_sync_network_observer.h b/content/browser/background_sync/background_sync_network_observer.h |
| index 7c81f738a92c01b799441e14a3366d71d4741f28..947128f048924e6575510311a61dcabd7b694fa7 100644 |
| --- a/content/browser/background_sync/background_sync_network_observer.h |
| +++ b/content/browser/background_sync/background_sync_network_observer.h |
| @@ -13,7 +13,7 @@ |
| namespace content { |
| class CONTENT_EXPORT BackgroundSyncNetworkObserver |
| - : net::NetworkChangeNotifier::NetworkChangeObserver { |
| + : public net::NetworkChangeNotifier::NetworkChangeObserver { |
| public: |
| // Creates a BackgroundSyncNetworkObserver. |network_changed_callback| is |
| // called when the network connection changes asynchronously via PostMessage. |
| @@ -21,22 +21,34 @@ class CONTENT_EXPORT BackgroundSyncNetworkObserver |
| ~BackgroundSyncNetworkObserver() override; |
| + // Enable or disable notifications coming from the NetworkChangeNotifier. (For |
| + // preventing flakes in tests) |
| + static void SetIgnoreNetworkChangeNotifierForTests(bool ignore); |
| + |
| // Returns true if the state of the network meets the needs of |
| // |network_state|. |
| bool NetworkSufficient(SyncNetworkState network_state); |
| - private: |
| - void NotifyNetworkChanged(); |
| - |
| // NetworkChangeObserver overrides |
| void OnNetworkChanged( |
| net::NetworkChangeNotifier::ConnectionType connection_type) override; |
| + // Calls NotifyNetworkChanged if the connection type has changed. |
| + void NotifyManagerIfNetworkChanged( |
|
jkarlin
2015/09/24 17:51:30
This would be private if not for tests. Make this
iclelland
2015/09/24 20:37:20
Done. I've friended the test classes (and moved Ba
|
| + net::NetworkChangeNotifier::ConnectionType connection_type); |
| + |
| + private: |
| + void NotifyNetworkChanged(); |
| + |
| net::NetworkChangeNotifier::ConnectionType connection_type_; |
| // The callback to run when the network changes. |
| base::Closure network_changed_callback_; |
| + // Set true to ignore notifications coming from the NetworkChangeNotifier |
| + // (to prevent flakes in tests). |
| + static bool ignore_network_change_notifier_; |
|
jkarlin
2015/09/24 17:51:30
I think you can initialize this to false here.
iclelland
2015/09/24 20:37:19
Nah.... "error: ISO C++ forbids in-class initiali
jkarlin
2015/09/24 23:33:12
Bah, that's right.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(BackgroundSyncNetworkObserver); |
| }; |