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

Unified Diff: net/android/java/src/org/chromium/net/NetworkChangeNotifier.java

Issue 1294603003: [BackgroundSync] Trigger Background Sync events when Chrome is backgrounded on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (Post-Blink-Chromium-Merge) Created 5 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 side-by-side diff with in-line comments
Download patch
Index: net/android/java/src/org/chromium/net/NetworkChangeNotifier.java
diff --git a/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java b/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java
index 563ef5c0d2cda697938fedf3371f573a51ffa5ba..f76a27096057a920c85964958325bc56a2a65554 100644
--- a/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java
+++ b/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java
@@ -81,7 +81,13 @@ public class NetworkChangeNotifier {
* Calls a native map lookup of subtype to max bandwidth.
*/
public static double getMaxBandwidthForConnectionSubtype(int subtype) {
- return nativeGetMaxBandwidthForConnectionSubtype(subtype);
+ // This may fail in unit tests, if the JNI native methods have not been registered.
jkarlin 2015/09/24 17:51:30 Ditto
iclelland 2015/09/24 20:37:20 Acknowledged.
+ try {
+ return nativeGetMaxBandwidthForConnectionSubtype(subtype);
+ } catch (UnsatisfiedLinkError e) {
+ // Return an arbitrary value for unit tests
+ return 0.0;
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698