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

Side by Side Diff: net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java

Issue 10928193: Add native-side unit test for Android NetworkChangeNotifier (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebasing Created 8 years, 3 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
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 package org.chromium.net; 5 package org.chromium.net;
6 6
7 import android.content.BroadcastReceiver; 7 import android.content.BroadcastReceiver;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.IntentFilter; 10 import android.content.IntentFilter;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 @Override 123 @Override
124 public void onReceive(Context context, Intent intent) { 124 public void onReceive(Context context, Intent intent) {
125 boolean noConnection = 125 boolean noConnection =
126 intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY , false); 126 intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY , false);
127 int newConnectionType = noConnection ? 127 int newConnectionType = noConnection ?
128 NetworkChangeNotifier.CONNECTION_NONE : currentConnectionType(co ntext); 128 NetworkChangeNotifier.CONNECTION_NONE : currentConnectionType(co ntext);
129 129
130 if (newConnectionType != mConnectionType) { 130 if (newConnectionType != mConnectionType) {
131 mConnectionType = newConnectionType; 131 mConnectionType = newConnectionType;
132 Log.d(TAG, "Network connectivity changed, type is: " + mConnectionTy pe); 132 Log.d(TAG, "Network connectivity changed, type is: " + mConnectionTy pe);
133 mOwner.notifyNativeObservers(); 133 mOwner.notifyObserversOfConnectionTypeChange();
134 } 134 }
135 } 135 }
136 136
137 // AcitivityStatus.Listener 137 // AcitivityStatus.Listener
138 @Override 138 @Override
139 public void onActivityStatusChanged(boolean isPaused) { 139 public void onActivityStatusChanged(boolean isPaused) {
140 if (isPaused) { 140 if (isPaused) {
141 unregisterReceiver(); 141 unregisterReceiver();
142 } else { 142 } else {
143 registerReceiver(); 143 registerReceiver();
144 } 144 }
145 } 145 }
146 146
147 private static class NetworkConnectivityIntentFilter extends IntentFilter { 147 private static class NetworkConnectivityIntentFilter extends IntentFilter {
148 NetworkConnectivityIntentFilter() { 148 NetworkConnectivityIntentFilter() {
149 addAction(ConnectivityManager.CONNECTIVITY_ACTION); 149 addAction(ConnectivityManager.CONNECTIVITY_ACTION);
150 } 150 }
151 } 151 }
152 } 152 }
OLDNEW
« no previous file with comments | « net/android/java/src/org/chromium/net/NetworkChangeNotifier.java ('k') | net/android/net_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698