diff options
author | jkarlin <jkarlin@chromium.org> | 2014-12-02 13:06:02 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-02 21:06:29 +0000 |
commit | 0818d5258da98f1e638db98c15ef398993ab59b0 (patch) | |
tree | afd9ab638546bd7958748c0bc6ba340c7ea89f39 /net/android/network_change_notifier_android_unittest.cc | |
parent | 3095df19e34073db2d3e6c76e242214fb8d1d841 (diff) | |
download | chromium_src-0818d5258da98f1e638db98c15ef398993ab59b0.zip chromium_src-0818d5258da98f1e638db98c15ef398993ab59b0.tar.gz chromium_src-0818d5258da98f1e638db98c15ef398993ab59b0.tar.bz2 |
Add MaxBandwidth support to Android's NetworkChangeNotifier as defined in the NetInfo spec: http://w3c.github.io/netinfo/.
* Provides an Android override for NetworkChangeNotifier::GetCurrentMaxBandwidth.
* Adds NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype and JNI to call it from Java.
* Adds java unittests
* Wifi permission is required (the permission was recently removed from content shell and tests in https://codereview.chromium.org/747553002/ as it was thought unnecessary but I'm adding it back everywhere but in cronet where it won't be used).
* Programatically copy the NetworkChangeNotifier C++ enums to Java instead of manually doing it, this requires some gyp/gn changes.
BUG=433370
Review URL: https://codereview.chromium.org/577363002
Cr-Commit-Position: refs/heads/master@{#306453}
Diffstat (limited to 'net/android/network_change_notifier_android_unittest.cc')
-rw-r--r-- | net/android/network_change_notifier_android_unittest.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/android/network_change_notifier_android_unittest.cc b/net/android/network_change_notifier_android_unittest.cc index 6aadb54..0818d5a 100644 --- a/net/android/network_change_notifier_android_unittest.cc +++ b/net/android/network_change_notifier_android_unittest.cc @@ -213,4 +213,17 @@ TEST_F(NetworkChangeNotifierAndroidTest, other_connection_type_observer_.notifications_count()); } +TEST_F(NetworkChangeNotifierAndroidTest, MaxBandwidth) { + SetOnline(); + EXPECT_EQ(NetworkChangeNotifier::CONNECTION_UNKNOWN, + notifier_.GetConnectionType()); + EXPECT_EQ(std::numeric_limits<double>::infinity(), + notifier_.GetMaxBandwidth()); + + SetOffline(); + EXPECT_EQ(NetworkChangeNotifier::CONNECTION_NONE, + notifier_.GetConnectionType()); + EXPECT_EQ(0.0, notifier_.GetMaxBandwidth()); +} + } // namespace net |