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

Side by Side Diff: content/browser/background_sync/background_sync_network_observer.h

Issue 1423313006: Add browser tests for clearing sync registrations with site data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove TODO Created 5 years, 1 month 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_ 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_ 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "content/browser/background_sync/background_sync.pb.h" 9 #include "content/browser/background_sync/background_sync.pb.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
(...skipping 15 matching lines...) Expand all
26 static void SetIgnoreNetworkChangeNotifierForTests(bool ignore); 26 static void SetIgnoreNetworkChangeNotifierForTests(bool ignore);
27 27
28 // Returns true if the state of the network meets the needs of 28 // Returns true if the state of the network meets the needs of
29 // |network_state|. 29 // |network_state|.
30 bool NetworkSufficient(SyncNetworkState network_state); 30 bool NetworkSufficient(SyncNetworkState network_state);
31 31
32 // NetworkChangeObserver overrides 32 // NetworkChangeObserver overrides
33 void OnNetworkChanged( 33 void OnNetworkChanged(
34 net::NetworkChangeNotifier::ConnectionType connection_type) override; 34 net::NetworkChangeNotifier::ConnectionType connection_type) override;
35 35
36 // Allow tests to call NotifyManagerIfNetworkChanged.
37 void NotifyManagerIfNetworkChangedForTesting(
38 net::NetworkChangeNotifier::ConnectionType connection_type);
39
36 private: 40 private:
37 friend class BackgroundSyncBrowserTest;
38 friend class BackgroundSyncManagerTest;
39 friend class BackgroundSyncServiceImplTest;
40
41 // Calls NotifyNetworkChanged if the connection type has changed. 41 // Calls NotifyNetworkChanged if the connection type has changed.
42 void NotifyManagerIfNetworkChanged( 42 void NotifyManagerIfNetworkChanged(
43 net::NetworkChangeNotifier::ConnectionType connection_type); 43 net::NetworkChangeNotifier::ConnectionType connection_type);
44 44
45 void NotifyNetworkChanged(); 45 void NotifyNetworkChanged();
46 46
47 net::NetworkChangeNotifier::ConnectionType connection_type_; 47 net::NetworkChangeNotifier::ConnectionType connection_type_;
48 48
49 // The callback to run when the network changes. 49 // The callback to run when the network changes.
50 base::Closure network_changed_callback_; 50 base::Closure network_changed_callback_;
51 51
52 // Set true to ignore notifications coming from the NetworkChangeNotifier 52 // Set true to ignore notifications coming from the NetworkChangeNotifier
53 // (to prevent flakes in tests). 53 // (to prevent flakes in tests).
54 static bool ignore_network_change_notifier_; 54 static bool ignore_network_change_notifier_;
55 55
56 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncNetworkObserver); 56 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncNetworkObserver);
57 }; 57 };
58 58
59 } // namespace content 59 } // namespace content
60 60
61 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_ 61 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698