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

Unified Diff: chrome/browser/chromeos/net/connectivity_state_helper.cc

Issue 14179007: Move cryptohome_library to src/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/net/connectivity_state_helper.cc
diff --git a/chrome/browser/chromeos/net/connectivity_state_helper.cc b/chrome/browser/chromeos/net/connectivity_state_helper.cc
index 0ded77b4aa2d28da0d729149dceaa38e31d0d9a3..c03903d63b2ef929977e829db9e0c8dd68f6706e 100644
--- a/chrome/browser/chromeos/net/connectivity_state_helper.cc
+++ b/chrome/browser/chromeos/net/connectivity_state_helper.cc
@@ -16,6 +16,7 @@
namespace chromeos {
static ConnectivityStateHelper* g_connectivity_state_helper = NULL;
+static ConnectivityStateHelper* g_test_connectivity_state_helper = NULL;
// Implementation of the connectivity state helper that uses the network
// state handler for fetching connectivity state.
@@ -86,14 +87,6 @@ void ConnectivityStateHelper::Initialize() {
}
// static
-void ConnectivityStateHelper::InitializeForTesting(
- ConnectivityStateHelper* connectivity_state_helper) {
- CHECK(!g_connectivity_state_helper);
- CHECK(connectivity_state_helper);
- g_connectivity_state_helper = connectivity_state_helper;
-}
-
-// static
bool ConnectivityStateHelper::IsInitialized() {
return g_connectivity_state_helper != NULL;
}
@@ -107,11 +100,19 @@ void ConnectivityStateHelper::Shutdown() {
// static
ConnectivityStateHelper* ConnectivityStateHelper::Get() {
- CHECK(g_connectivity_state_helper)
+ CHECK(g_connectivity_state_helper || g_test_connectivity_state_helper)
<< "ConnectivityStateHelper: Get() called before Initialize()";
+ if (g_test_connectivity_state_helper)
+ return g_test_connectivity_state_helper;
return g_connectivity_state_helper;
}
+// static
+void ConnectivityStateHelper::SetForTest(ConnectivityStateHelper* impl) {
+ CHECK(!g_test_connectivity_state_helper || !impl);
+ g_test_connectivity_state_helper = impl;
+}
+
void ConnectivityStateHelper::AddNetworkManagerObserver(
ConnectivityStateHelperObserver* observer) {
network_manager_observers_.AddObserver(observer);

Powered by Google App Engine
This is Rietveld 408576698