| 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..4d47cc6a6c3970396a3195a31a271ab3df2122f4 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,37 @@ 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;
|
|
|
| + private:
|
| + friend class BackgroundSyncBrowserTest;
|
| + friend class BackgroundSyncManagerTest;
|
| +
|
| + // Calls NotifyNetworkChanged if the connection type has changed.
|
| + void NotifyManagerIfNetworkChanged(
|
| + net::NetworkChangeNotifier::ConnectionType connection_type);
|
| +
|
| + 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_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BackgroundSyncNetworkObserver);
|
| };
|
|
|
|
|