summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2017-03-27 15:55:10 -0700
committerLorenzo Colitti <lorenzo@google.com>2017-04-14 21:49:32 +0900
commit9440acb666a0ec018fb9e0a6ff682d97ca97c076 (patch)
tree719a0f239d6b78031f33077f41f138a03f1ce38a /tests
parent6b5a927441eb803a9c81eb4b06f06c1b0182ccd3 (diff)
Make the NetworkSpecifier a class instead of a string.
Bug: 27533960 Bug: 36053921 Bug: 36275276 Test: unit tests (wifi), integration (aware) tests Change-Id: I6524e678a2f116ec8799c4c029bb3823dd889b2b Merged-In: I9a52ccc70177a86d70cb8f24246109672837875c Merged-In: Ic9fe860aa016d27a981cd76cf4f4214ce2d2bd69
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
index 29d0d12a6..912dce2f3 100644
--- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
@@ -37,6 +37,7 @@ import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.net.NetworkFactory;
import android.net.NetworkRequest;
+import android.net.StringNetworkSpecifier;
import android.net.wifi.aware.AttachCallback;
import android.net.wifi.aware.ConfigRequest;
import android.net.wifi.aware.DiscoverySession;
@@ -417,10 +418,12 @@ public class WifiAwareDataPathStateManagerTest {
doPublish);
// corrupt the network specifier: reverse the role (so it's mis-matched)
- JSONObject jsonObject = new JSONObject(nr.networkCapabilities.getNetworkSpecifier());
+ JSONObject jsonObject = new JSONObject(
+ ((StringNetworkSpecifier) nr.networkCapabilities.getNetworkSpecifier()).specifier);
jsonObject.put(WifiAwareManager.NETWORK_SPECIFIER_KEY_ROLE,
1 - jsonObject.getInt(WifiAwareManager.NETWORK_SPECIFIER_KEY_ROLE));
- nr.networkCapabilities.setNetworkSpecifier(jsonObject.toString());
+ nr.networkCapabilities.setNetworkSpecifier(
+ new StringNetworkSpecifier(jsonObject.toString()));
Message reqNetworkMsg = Message.obtain();
reqNetworkMsg.what = NetworkFactory.CMD_REQUEST_NETWORK;
@@ -691,7 +694,7 @@ public class WifiAwareDataPathStateManagerTest {
nc.addTransportType(NetworkCapabilities.TRANSPORT_WIFI_AWARE);
nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN).addCapability(
NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
- nc.setNetworkSpecifier(ns);
+ nc.setNetworkSpecifier(new StringNetworkSpecifier(ns));
nc.setLinkUpstreamBandwidthKbps(1);
nc.setLinkDownstreamBandwidthKbps(1);
nc.setSignalStrength(1);
@@ -729,7 +732,7 @@ public class WifiAwareDataPathStateManagerTest {
nc.addTransportType(NetworkCapabilities.TRANSPORT_WIFI_AWARE);
nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN).addCapability(
NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
- nc.setNetworkSpecifier(ns);
+ nc.setNetworkSpecifier(new StringNetworkSpecifier(ns));
nc.setLinkUpstreamBandwidthKbps(1);
nc.setLinkDownstreamBandwidthKbps(1);
nc.setSignalStrength(1);