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

Unified Diff: net/android/network_change_notifier_android_unittest.cc

Issue 2866253002: Refactor NetworkChangeNotifierAndroid (Closed)
Patch Set: Add test to make sure NCN doesn't call native functions during startup Created 3 years, 7 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/network_change_notifier_android_unittest.cc
diff --git a/net/android/network_change_notifier_android_unittest.cc b/net/android/network_change_notifier_android_unittest.cc
index 7c54250cb6c2605634ac04dce69c907ffbe1a780..3069e6bb4edb1bd0d9a305b89e7bf6a6e60e2f06 100644
--- a/net/android/network_change_notifier_android_unittest.cc
+++ b/net/android/network_change_notifier_android_unittest.cc
@@ -181,6 +181,7 @@ class TestNetworkObserver : public NetworkChangeNotifier::NetworkObserver {
class BaseNetworkChangeNotifierAndroidTest : public testing::Test {
protected:
typedef NetworkChangeNotifier::ConnectionType ConnectionType;
+ typedef NetworkChangeNotifier::ConnectionSubtype ConnectionSubtype;
~BaseNetworkChangeNotifierAndroidTest() override {}
@@ -224,8 +225,8 @@ class BaseNetworkChangeNotifierAndroidTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
- void FakeMaxBandwidthChange(double max_bandwidth_mbps) {
- delegate_.FakeMaxBandwidthChanged(max_bandwidth_mbps);
+ void FakeConnectionSubtypeChange(ConnectionSubtype subtype) {
+ delegate_.FakeConnectionSubtypeChanged(subtype);
base::RunLoop().RunUntilIdle();
}
@@ -396,15 +397,15 @@ TEST_F(NetworkChangeNotifierAndroidTest, MaxBandwidth) {
TEST_F(NetworkChangeNotifierDelegateAndroidTest, MaxBandwidthCallbackNotifier) {
// The bandwidth notification should always be forwarded, even if the value
// doesn't change (because the type might have changed).
- FakeMaxBandwidthChange(100.0);
+ FakeConnectionSubtypeChange(ConnectionSubtype::SUBTYPE_CDMA);
EXPECT_EQ(1, delegate_observer_.bandwidth_notifications_count());
EXPECT_EQ(1, max_bandwidth_observer_.notifications_count());
- FakeMaxBandwidthChange(100.0);
+ FakeConnectionSubtypeChange(ConnectionSubtype::SUBTYPE_CDMA);
EXPECT_EQ(2, delegate_observer_.bandwidth_notifications_count());
EXPECT_EQ(2, max_bandwidth_observer_.notifications_count());
- FakeMaxBandwidthChange(101.0);
+ FakeConnectionSubtypeChange(ConnectionSubtype::SUBTYPE_LTE);
EXPECT_EQ(3, delegate_observer_.bandwidth_notifications_count());
EXPECT_EQ(3, max_bandwidth_observer_.notifications_count());
}

Powered by Google App Engine
This is Rietveld 408576698