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

Unified Diff: net/base/network_change_notifier_unittest.cc

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « net/base/network_change_notifier_linux.cc ('k') | net/base/network_change_notifier_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier_unittest.cc
diff --git a/net/base/network_change_notifier_unittest.cc b/net/base/network_change_notifier_unittest.cc
index b8310fa5b7f63b2c656bd63daf65c83c7d1952e5..cb4e7745560ff516c6bec5df3731f78e71352db4 100644
--- a/net/base/network_change_notifier_unittest.cc
+++ b/net/base/network_change_notifier_unittest.cc
@@ -4,6 +4,7 @@
#include "net/base/network_change_notifier.h"
+#include "net/base/net_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -57,4 +58,33 @@ TEST(NetworkChangeNotifierTest, NetMaxBandwidthRange) {
}
}
+TEST(NetworkChangeNotifierTest, ConnectionTypeFromInterfaceList) {
+ NetworkInterfaceList list;
+
+ // Test empty list.
+ EXPECT_EQ(NetworkChangeNotifier::ConnectionTypeFromInterfaceList(list),
+ NetworkChangeNotifier::CONNECTION_NONE);
+
+ for (int i = NetworkChangeNotifier::CONNECTION_UNKNOWN;
+ i <= NetworkChangeNotifier::CONNECTION_LAST; i++) {
+ // Check individual types.
+ NetworkInterface interface;
+ interface.type = static_cast<NetworkChangeNotifier::ConnectionType>(i);
+ list.clear();
+ list.push_back(interface);
+ EXPECT_EQ(NetworkChangeNotifier::ConnectionTypeFromInterfaceList(list), i);
+ // Check two types.
+ for (int j = NetworkChangeNotifier::CONNECTION_UNKNOWN;
+ j <= NetworkChangeNotifier::CONNECTION_LAST; j++) {
+ list.clear();
+ interface.type = static_cast<NetworkChangeNotifier::ConnectionType>(i);
+ list.push_back(interface);
+ interface.type = static_cast<NetworkChangeNotifier::ConnectionType>(j);
+ list.push_back(interface);
+ EXPECT_EQ(NetworkChangeNotifier::ConnectionTypeFromInterfaceList(list),
+ i == j ? i : NetworkChangeNotifier::CONNECTION_UNKNOWN);
+ }
+ }
+}
+
} // namespace net
« no previous file with comments | « net/base/network_change_notifier_linux.cc ('k') | net/base/network_change_notifier_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698