summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-08-07 22:18:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-08-07 22:18:15 +0000
commit058fc1de39ed8c11473bf9d60aac92dbf21106c0 (patch)
tree4a85220cea49c0a58a865f63e43abfc38d008f56 /tests
parent7b0a925a6b914c16a4606a14d644878b5039474b (diff)
parentc4713c9006b236bf1c7d0bf82b50bfb6b1eb53b6 (diff)
Merge "ScanRequestProxy: Return copy of list in getScanResults" into rvc-qpr-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java b/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java
index b065f823c..cc96602d5 100644
--- a/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ScanRequestProxyTest.java
@@ -22,6 +22,8 @@ import static com.android.server.wifi.ScanRequestProxy.SCAN_REQUEST_THROTTLE_MAX
import static com.android.server.wifi.ScanRequestProxy.SCAN_REQUEST_THROTTLE_TIME_WINDOW_FG_APPS_MS;
import static com.android.server.wifi.WifiSettingsConfigStore.WIFI_SCAN_THROTTLE_ENABLED;
+import static com.google.common.truth.Truth.assertThat;
+
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -1009,6 +1011,19 @@ public class ScanRequestProxyTest extends WifiBaseTest {
mLooper.dispatchAll();
validateScanResultsAvailableBroadcastSent(true);
verify(mScanResultsCallback, never()).onScanResultsAvailable();
+ }
+
+ /** Test that modifying the returned scan results list does not change the original. */
+ @Test
+ public void testGetScanResults_modifyReturnedList_doesNotChangeOriginal() {
+ // initialize scan results
+ testStartScanSuccess();
+
+ List<ScanResult> scanResults = mScanRequestProxy.getScanResults();
+ int scanResultsOriginalSize = scanResults.size();
+
+ scanResults.add(new ScanResult());
+ assertThat(mScanRequestProxy.getScanResults()).hasSize(scanResultsOriginalSize);
}
}