Commit 1bd3e56f authored by Tamir Duberstein's avatar Tamir Duberstein Committed by Commit Bot

[fuchsia] Prepare to migrate NetInterface::features.

This is reworking changes made in b115d096.

Bug: 1099393
Change-Id: Id5d092887298a70ad4cc4dc9aaf97390a403933c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354883Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Tamir Duberstein <tamird@google.com>
Cr-Commit-Position: refs/heads/master@{#798060}
parent d3e33c73
......@@ -100,11 +100,11 @@ void NetworkChangeNotifierFuchsia::OnRouteTableReceived(
base::flat_set<IPAddress> addresses;
for (auto& interface : interfaces) {
// Filter out loopback and invalid connection types.
auto loopback = static_cast<decltype(interface.features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_LOOPBACK);
if ((internal::ConvertConnectionType(interface) ==
NetworkChangeNotifier::CONNECTION_NONE) ||
(interface.features &
static_cast<decltype(interface.features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_LOOPBACK))) {
((interface.features & loopback) == loopback)) {
continue;
}
......
......@@ -355,7 +355,8 @@ TEST_F(NetworkChangeNotifierFuchsiaTest, NotifyNetworkChangeOnInitialIPChange) {
// Set a live interface with an IP address and create the notifier.
std::vector<fuchsia::netstack::NetInterface> interfaces(1);
interfaces[0] = DefaultNetInterface();
interfaces[0].features = {fuchsia::hardware::ethernet::INFO_FEATURE_WLAN};
interfaces[0].features = static_cast<decltype(interfaces[0].features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_WLAN);
netstack_.SetInterfaces(interfaces);
CreateNotifier();
......@@ -556,7 +557,8 @@ TEST_F(NetworkChangeNotifierFuchsiaTest, InterfaceAdded) {
std::vector<fuchsia::netstack::NetInterface> interfaces(1);
interfaces[0] = DefaultNetInterface();
interfaces[0].features = {fuchsia::hardware::ethernet::INFO_FEATURE_WLAN};
interfaces[0].features = static_cast<decltype(interfaces[0].features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_WLAN);
netstack_.SetInterfaces(interfaces);
......@@ -591,7 +593,8 @@ TEST_F(NetworkChangeNotifierFuchsiaTest, SecondaryInterfaceDeletedNoop) {
TEST_F(NetworkChangeNotifierFuchsiaTest, FoundWiFi) {
std::vector<fuchsia::netstack::NetInterface> interfaces(1);
interfaces[0] = DefaultNetInterface();
interfaces[0].features = {fuchsia::hardware::ethernet::INFO_FEATURE_WLAN};
interfaces[0].features = static_cast<decltype(interfaces[0].features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_WLAN);
netstack_.SetInterfaces(interfaces);
CreateNotifier();
......@@ -602,7 +605,8 @@ TEST_F(NetworkChangeNotifierFuchsiaTest, FoundWiFi) {
TEST_F(NetworkChangeNotifierFuchsiaTest, FindsInterfaceWithRequiredFeature) {
std::vector<fuchsia::netstack::NetInterface> interfaces(1);
interfaces[0] = DefaultNetInterface();
interfaces[0].features = {fuchsia::hardware::ethernet::INFO_FEATURE_WLAN};
interfaces[0].features = static_cast<decltype(interfaces[0].features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_WLAN);
netstack_.SetInterfaces(interfaces);
CreateNotifier(fuchsia::hardware::ethernet::INFO_FEATURE_WLAN);
......
......@@ -60,11 +60,11 @@ NetworkInterface NetworkInterfaceFromAddress(
NetworkChangeNotifier::ConnectionType ConvertConnectionType(
const fuchsia::netstack::NetInterface& iface) {
auto wlan = static_cast<decltype(iface.features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_WLAN);
if (!(iface.flags & fuchsia::netstack::NetInterfaceFlagUp)) {
return NetworkChangeNotifier::CONNECTION_NONE;
} else if (iface.features &
static_cast<decltype(iface.features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_WLAN)) {
} else if ((iface.features & wlan) == wlan) {
return NetworkChangeNotifier::CONNECTION_WIFI;
}
return NetworkChangeNotifier::CONNECTION_UNKNOWN;
......@@ -120,11 +120,11 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
}
for (auto& interface : interfaces) {
auto loopback = static_cast<decltype(interface.features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_LOOPBACK);
if ((internal::ConvertConnectionType(interface) ==
NetworkChangeNotifier::CONNECTION_NONE) ||
(interface.features &
static_cast<decltype(interface.features)>(
fuchsia::hardware::ethernet::INFO_FEATURE_LOOPBACK))) {
((interface.features & loopback) == loopback)) {
continue;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment