1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.wifi.scanner;
18 
19 import static com.android.server.wifi.ScanTestUtil.bandIs;
20 import static com.android.server.wifi.ScanTestUtil.channelsAre;
21 import static com.android.server.wifi.ScanTestUtil.channelsToSpec;
22 import static com.android.server.wifi.ScanTestUtil.createRequest;
23 
24 import static org.hamcrest.MatcherAssert.assertThat;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.assertFalse;
27 import static org.junit.Assert.assertNull;
28 import static org.junit.Assert.assertTrue;
29 
30 import android.net.wifi.WifiScanner;
31 
32 import androidx.test.filters.SmallTest;
33 
34 import com.android.server.wifi.WifiBaseTest;
35 import com.android.server.wifi.WifiNative;
36 
37 import org.junit.Before;
38 import org.junit.Test;
39 import org.junit.experimental.runners.Enclosed;
40 import org.junit.runner.RunWith;
41 
42 import java.util.Arrays;
43 import java.util.Collections;
44 import java.util.HashSet;
45 
46 /**
47  * Unit tests for {@link com.android.server.wifi.scanner.KnownBandsChannelHelper}.
48  */
49 @RunWith(Enclosed.class) // WARNING: tests cannot be declared in the outer class
50 public class KnownBandsChannelHelperTest {
51 
52     private static final int[] CHANNELS_24_GHZ = new int[]{2412, 2450};
53     private static final int[] CHANNELS_5_GHZ = new int[]{5160, 5175};
54     private static final int[] CHANNELS_DFS = new int[]{5600, 5650, 5660};
55     private static final int[] CHANNELS_DFS_OTHER = new int[]{5600, 5650, 5660, 5680};
56     private static final int[] CHANNELS_6_GHZ = new int[]{5945, 5985};
57     private static final int[] CHANNELS_60_GHZ = new int[]{58320, 60480};
58 
59     /**
60      * Unit tests for
61      * {@link com.android.server.wifi.scanner.KnownBandsChannelHelper.estimateScanDuration}.
62      */
63     @SmallTest
64     public static class EstimateScanDurationTest extends WifiBaseTest {
65         KnownBandsChannelHelper mChannelHelper;
66 
67         /**
68          * Called before each test
69          * Create a channel helper
70          */
71         @Before
setUp()72         public void setUp() throws Exception {
73             mChannelHelper = new PresetKnownBandsChannelHelper(
74                     CHANNELS_24_GHZ,
75                     CHANNELS_5_GHZ,
76                     CHANNELS_DFS,
77                     CHANNELS_6_GHZ,
78                     CHANNELS_60_GHZ);
79         }
80 
81         /**
82          * check a settings object with a few channels
83          */
84         @Test
fewChannels()85         public void fewChannels() {
86             WifiScanner.ScanSettings testSettings = createRequest(channelsToSpec(2412, 2450, 5200),
87                     10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
88 
89             assertEquals(ChannelHelper.SCAN_PERIOD_PER_CHANNEL_MS * 3,
90                     mChannelHelper.estimateScanDuration(testSettings));
91         }
92 
93         /**
94          * check a settings object with a band
95          */
96         @Test
band()97         public void band() {
98             WifiScanner.ScanSettings testSettings = createRequest(WifiScanner.WIFI_BAND_24_GHZ,
99                     10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
100 
101             assertEquals(ChannelHelper.SCAN_PERIOD_PER_CHANNEL_MS * CHANNELS_24_GHZ.length,
102                     mChannelHelper.estimateScanDuration(testSettings));
103         }
104     }
105 
106     /**
107      * Unit tests for
108      * {@link com.android.server.wifi.scanner.KnownBandsChannelHelper.getAvailableScanChannels}.
109      */
110     @SmallTest
111     public static class GetAvailableScanChannelsTest extends WifiBaseTest {
112         KnownBandsChannelHelper mChannelHelper;
113 
114         /**
115          * Called before each test
116          * Create a channel helper
117          */
118         @Before
setUp()119         public void setUp() throws Exception {
120             mChannelHelper = new PresetKnownBandsChannelHelper(
121                     CHANNELS_24_GHZ,
122                     CHANNELS_5_GHZ,
123                     CHANNELS_DFS,
124                     CHANNELS_6_GHZ,
125                     CHANNELS_60_GHZ);
126         }
127 
testBand(int[] expectedChannels, int band)128         private void testBand(int[] expectedChannels, int band) {
129             WifiScanner.ChannelSpec[][] channels =
130                     mChannelHelper.getAvailableScanChannels(band);
131             int len = 0;
132             for (int i = 0; i < channels.length; ++i) {
133                 len += channels[i].length;
134             }
135             assertEquals("num channels", expectedChannels.length, len);
136             int index = 0;
137             for (int i = 0; i < channels.length; ++i) {
138                 for (int j = 0; j < channels[i].length; ++j) {
139                     assertEquals("channels[" + index + "].frequency",
140                             expectedChannels[index++], channels[i][j].frequency);
141                 }
142             }
143         }
144 
145         /**
146          * test the 2.4GHz band
147          */
148         @Test
channels24Ghz()149         public void channels24Ghz() {
150             testBand(CHANNELS_24_GHZ, WifiScanner.WIFI_BAND_24_GHZ);
151         }
152 
153         /**
154          * test the 5GHz band
155          */
156         @Test
channels5Ghz()157         public void channels5Ghz() {
158             testBand(CHANNELS_5_GHZ, WifiScanner.WIFI_BAND_5_GHZ);
159         }
160 
161         /**
162          * test the 5GHz DFS band
163          */
164         @Test
channelsDfs()165         public void channelsDfs() {
166             testBand(CHANNELS_DFS, WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY);
167         }
168 
169         /**
170          * test the 2.4GHz and 5GHz band
171          */
172         @Test
channels24GhzAnd5Ghz()173         public void channels24GhzAnd5Ghz() {
174             int[] expectedChannels = new int[CHANNELS_24_GHZ.length + CHANNELS_5_GHZ.length];
175             System.arraycopy(CHANNELS_24_GHZ, 0, expectedChannels, 0, CHANNELS_24_GHZ.length);
176             System.arraycopy(CHANNELS_5_GHZ, 0, expectedChannels, CHANNELS_24_GHZ.length,
177                     CHANNELS_5_GHZ.length);
178             testBand(expectedChannels, WifiScanner.WIFI_BAND_BOTH);
179         }
180 
181         /**
182          * test all bands
183          */
184         @Test
channelsAll()185         public void channelsAll() {
186             int[] expectedChannels =
187                     new int[CHANNELS_24_GHZ.length + CHANNELS_5_GHZ.length + CHANNELS_DFS.length
188                             + CHANNELS_6_GHZ.length + CHANNELS_60_GHZ.length];
189             System.arraycopy(CHANNELS_24_GHZ, 0, expectedChannels, 0, CHANNELS_24_GHZ.length);
190             System.arraycopy(CHANNELS_5_GHZ, 0, expectedChannels, CHANNELS_24_GHZ.length,
191                     CHANNELS_5_GHZ.length);
192             System.arraycopy(CHANNELS_DFS, 0, expectedChannels,
193                     CHANNELS_24_GHZ.length + CHANNELS_5_GHZ.length,
194                     CHANNELS_DFS.length);
195             System.arraycopy(CHANNELS_6_GHZ, 0, expectedChannels,
196                     CHANNELS_24_GHZ.length + CHANNELS_5_GHZ.length + CHANNELS_DFS.length,
197                     CHANNELS_6_GHZ.length);
198             System.arraycopy(CHANNELS_60_GHZ, 0, expectedChannels,
199                     CHANNELS_24_GHZ.length + CHANNELS_5_GHZ.length + CHANNELS_DFS.length
200                     + CHANNELS_6_GHZ.length,
201                     CHANNELS_60_GHZ.length);
202             testBand(expectedChannels, WifiScanner.WIFI_BAND_24_5_WITH_DFS_6_60_GHZ);
203         }
204     }
205 
206     /**
207      * Unit tests for
208      * {@link com.android.server.wifi.scanner.KnownBandsChannelHelper.settingsContainChannel}.
209      */
210     @SmallTest
211     public static class SettingsContainChannelTest extends WifiBaseTest {
212         KnownBandsChannelHelper mChannelHelper;
213 
214         /**
215          * Called before each test
216          * Create a channel helper
217          */
218         @Before
setUp()219         public void setUp() throws Exception {
220             mChannelHelper = new PresetKnownBandsChannelHelper(
221                     CHANNELS_24_GHZ,
222                     CHANNELS_5_GHZ,
223                     CHANNELS_DFS,
224                     CHANNELS_6_GHZ,
225                     CHANNELS_60_GHZ);
226         }
227 
228         /**
229          * check a settings object with no channels
230          */
231         @Test
emptySettings()232         public void emptySettings() {
233             WifiScanner.ScanSettings testSettings = createRequest(channelsToSpec(),
234                     10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
235 
236             assertFalse(mChannelHelper.settingsContainChannel(testSettings, 2412));
237             assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5160));
238             assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5650));
239         }
240 
241         /**
242          * check a settings object with some channels
243          */
244         @Test
settingsWithChannels()245         public void settingsWithChannels() {
246             WifiScanner.ScanSettings testSettings = createRequest(channelsToSpec(2412, 5650),
247                     10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
248 
249             assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2412));
250             assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5160));
251             assertTrue(mChannelHelper.settingsContainChannel(testSettings, 5650));
252         }
253 
254         /**
255          * check a settings object with a band specified
256          */
257         @Test
settingsWithBand()258         public void settingsWithBand() {
259             WifiScanner.ScanSettings testSettings = createRequest(WifiScanner.WIFI_BAND_24_GHZ,
260                     10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
261 
262             assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2412));
263             assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2450));
264             assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5160));
265             assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5650));
266         }
267 
268         /**
269          * check a settings object with multiple bands specified
270          */
271         @Test
settingsWithMultiBand()272         public void settingsWithMultiBand() {
273             WifiScanner.ScanSettings testSettings = createRequest(WifiScanner.WIFI_BAND_BOTH,
274                     10000, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
275 
276             assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2412));
277             assertTrue(mChannelHelper.settingsContainChannel(testSettings, 2450));
278             assertTrue(mChannelHelper.settingsContainChannel(testSettings, 5160));
279             assertFalse(mChannelHelper.settingsContainChannel(testSettings, 5650));
280         }
281     }
282 
283     /**
284      * Unit tests for
285      * {@link com.android.server.wifi.scanner.KnownBandsChannelHelper#equals(ChannelHelper)}.
286      */
287     @SmallTest
288     public static class EqualsTest extends WifiBaseTest {
289         /**
290          * Creates 2 channel helper instances which are equal.
291          */
292         @Test
channelHelpersAreSatisfiedBySame()293         public void channelHelpersAreSatisfiedBySame() {
294             KnownBandsChannelHelper channelHelper0 = new PresetKnownBandsChannelHelper(
295                     CHANNELS_24_GHZ,
296                     CHANNELS_5_GHZ,
297                     CHANNELS_DFS,
298                     CHANNELS_6_GHZ,
299                     CHANNELS_60_GHZ);
300             KnownBandsChannelHelper channelHelper1 = new PresetKnownBandsChannelHelper(
301                     CHANNELS_24_GHZ,
302                     CHANNELS_5_GHZ,
303                     CHANNELS_DFS,
304                     CHANNELS_6_GHZ,
305                     CHANNELS_60_GHZ);
306             assertTrue(channelHelper0.satisfies(channelHelper1));
307         }
308 
309         /**
310          * Creates 2 channel helper instances which are equal.
311          */
312         @Test
channelHelpersAreNotSatisfiedByDifferent()313         public void channelHelpersAreNotSatisfiedByDifferent() {
314             KnownBandsChannelHelper channelHelper0 = new PresetKnownBandsChannelHelper(
315                     CHANNELS_24_GHZ,
316                     CHANNELS_5_GHZ,
317                     CHANNELS_DFS,
318                     CHANNELS_6_GHZ,
319                     CHANNELS_60_GHZ);
320             KnownBandsChannelHelper channelHelper1 = new PresetKnownBandsChannelHelper(
321                     CHANNELS_24_GHZ,
322                     CHANNELS_5_GHZ,
323                     CHANNELS_DFS_OTHER,
324                     CHANNELS_6_GHZ,
325                     CHANNELS_60_GHZ);
326             assertFalse(channelHelper0.satisfies(channelHelper1));
327         }
328     }
329 
330     /**
331      * Unit tests for
332      * {@link com.android.server.wifi.scanner.KnownBandsChannelHelper.KnownBandsChannelCollection}.
333      */
334     @SmallTest
335     public static class KnownBandsChannelCollectionTest extends WifiBaseTest {
336         ChannelHelper.ChannelCollection mChannelCollection;
337 
338         /**
339          * Called before each test
340          * Create a collection to use for each test
341          */
342         @Before
setUp()343         public void setUp() throws Exception {
344             KnownBandsChannelHelper channelHelper = new PresetKnownBandsChannelHelper(
345                     CHANNELS_24_GHZ,
346                     CHANNELS_5_GHZ,
347                     CHANNELS_DFS,
348                     CHANNELS_6_GHZ,
349                     CHANNELS_60_GHZ);
350             mChannelCollection = channelHelper.createChannelCollection();
351         }
352 
353         /**
354          * Create an empty collection
355          */
356         @Test
empty()357         public void empty() {
358             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
359             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
360             assertThat(bucketSettings, channelsAre());
361 
362             assertEquals(Collections.<Integer>emptySet(),
363                     mChannelCollection.getScanFreqs());
364 
365             assertTrue(mChannelCollection.isEmpty());
366             assertFalse(mChannelCollection.containsChannel(2412));
367             assertFalse(mChannelCollection.containsChannel(5160));
368             assertFalse(mChannelCollection.containsChannel(58320));
369             assertFalse(mChannelCollection.isAllChannels());
370         }
371 
372         /**
373          * Add something to a collection and then clear it and make sure nothing is in it
374          */
375         @Test
clear()376         public void clear() {
377             mChannelCollection.addBand(WifiScanner.WIFI_BAND_24_GHZ);
378             mChannelCollection.clear();
379 
380             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
381             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
382             assertThat(bucketSettings, channelsAre());
383 
384             assertEquals(Collections.<Integer>emptySet(),
385                     mChannelCollection.getScanFreqs());
386 
387             assertTrue(mChannelCollection.isEmpty());
388             assertFalse(mChannelCollection.containsChannel(2412));
389             assertFalse(mChannelCollection.containsChannel(5160));
390             assertFalse(mChannelCollection.containsChannel(58320));
391             assertFalse(mChannelCollection.isAllChannels());
392         }
393 
394         /**
395          * Add a single band to the collection
396          */
397         @Test
addBand()398         public void addBand() {
399             mChannelCollection.addBand(WifiScanner.WIFI_BAND_24_GHZ);
400 
401             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
402             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
403             assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_24_GHZ));
404 
405             assertEquals(new HashSet<Integer>(Arrays.asList(2412, 2450)),
406                     mChannelCollection.getScanFreqs());
407 
408             assertFalse(mChannelCollection.isEmpty());
409             assertTrue(mChannelCollection.containsChannel(2412));
410             assertFalse(mChannelCollection.containsChannel(5160));
411             assertFalse(mChannelCollection.containsChannel(58320));
412             assertFalse(mChannelCollection.isAllChannels());
413         }
414 
415         /**
416          * Add a single channel to the collection
417          */
418         @Test
addChannel_single()419         public void addChannel_single() {
420             mChannelCollection.addChannel(2412);
421 
422             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
423             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
424             assertThat(bucketSettings, channelsAre(2412));
425 
426             assertEquals(new HashSet<Integer>(Arrays.asList(2412)),
427                     mChannelCollection.getScanFreqs());
428 
429             assertFalse(mChannelCollection.isEmpty());
430             assertTrue(mChannelCollection.containsChannel(2412));
431             assertFalse(mChannelCollection.containsChannel(5160));
432             assertFalse(mChannelCollection.containsChannel(58320));
433             assertFalse(mChannelCollection.isAllChannels());
434         }
435 
436         /**
437          * Add a multiple channels to the collection
438          */
439         @Test
addChannel_multiple()440         public void addChannel_multiple() {
441             mChannelCollection.addChannel(2412);
442             mChannelCollection.addChannel(2450);
443 
444             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
445             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
446             assertThat(bucketSettings, channelsAre(2412, 2450));
447 
448             assertEquals(new HashSet<Integer>(Arrays.asList(2412, 2450)),
449                     mChannelCollection.getScanFreqs());
450 
451             assertFalse(mChannelCollection.isEmpty());
452             assertTrue(mChannelCollection.containsChannel(2412));
453             assertFalse(mChannelCollection.containsChannel(5160));
454             assertFalse(mChannelCollection.containsChannel(58320));
455             assertFalse(mChannelCollection.isAllChannels());
456         }
457 
458         /**
459          * Add a band and channel that is on that band
460          */
461         @Test
addChannel_and_addBand_sameBand()462         public void addChannel_and_addBand_sameBand() {
463             mChannelCollection.addBand(WifiScanner.WIFI_BAND_24_GHZ);
464             mChannelCollection.addChannel(2412);
465 
466             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
467             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
468             assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_24_GHZ));
469 
470             assertEquals(new HashSet<Integer>(Arrays.asList(2412, 2450)),
471                     mChannelCollection.getScanFreqs());
472 
473             assertFalse(mChannelCollection.isEmpty());
474             assertTrue(mChannelCollection.containsChannel(2412));
475             assertFalse(mChannelCollection.containsChannel(5160));
476             assertFalse(mChannelCollection.containsChannel(58320));
477             assertFalse(mChannelCollection.isAllChannels());
478         }
479 
480         /**
481          * Add a band and channel that is not that band
482          */
483         @Test
addChannel_and_addBand_withDifferentBandChannel()484         public void addChannel_and_addBand_withDifferentBandChannel() {
485             mChannelCollection.addBand(WifiScanner.WIFI_BAND_24_GHZ);
486             mChannelCollection.addChannel(5160);
487 
488             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
489             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
490             assertThat(bucketSettings, channelsAre(2412, 2450, 5160));
491 
492             assertEquals(new HashSet<Integer>(Arrays.asList(2412, 2450, 5160)),
493                     mChannelCollection.getScanFreqs());
494 
495             assertFalse(mChannelCollection.isEmpty());
496             assertTrue(mChannelCollection.containsChannel(2412));
497             assertTrue(mChannelCollection.containsChannel(5160));
498             assertFalse(mChannelCollection.containsChannel(58320));
499             assertFalse(mChannelCollection.isAllChannels());
500         }
501 
502         /**
503          * Add a band that should contain all channels
504          */
505         @Test
addChannel_and_addBand_all()506         public void addChannel_and_addBand_all() {
507             mChannelCollection.addBand(WifiScanner.WIFI_BAND_24_5_WITH_DFS_6_60_GHZ);
508             mChannelCollection.addChannel(5160);
509 
510             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
511             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
512             assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_24_5_WITH_DFS_6_60_GHZ));
513 
514             assertNull(mChannelCollection.getScanFreqs());
515 
516             assertFalse(mChannelCollection.isEmpty());
517             assertTrue(mChannelCollection.containsChannel(2412));
518             assertTrue(mChannelCollection.containsChannel(5160));
519             assertTrue(mChannelCollection.containsChannel(5600));
520             assertTrue(mChannelCollection.containsChannel(58320));
521             assertTrue(mChannelCollection.containsChannel(60480));
522             assertTrue(mChannelCollection.isAllChannels());
523         }
524 
525         /**
526          * Add enough channels on a single band that the max channels is exceeded
527          */
528         @Test
addChannel_exceedMaxChannels()529         public void addChannel_exceedMaxChannels() {
530             mChannelCollection.addChannel(5600);
531             mChannelCollection.addChannel(5650);
532             mChannelCollection.addChannel(5660);
533 
534             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
535             mChannelCollection.fillBucketSettings(bucketSettings, 2);
536             assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY));
537             assertFalse(mChannelCollection.isAllChannels());
538         }
539 
540         /**
541          * Add enough channels across multiple bands that the max channels is exceeded
542          */
543         @Test
addChannel_exceedMaxChannelsOnMultipleBands()544         public void addChannel_exceedMaxChannelsOnMultipleBands() {
545             mChannelCollection.addChannel(2412);
546             mChannelCollection.addChannel(2450);
547             mChannelCollection.addChannel(5160);
548 
549             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
550             mChannelCollection.fillBucketSettings(bucketSettings, 2);
551             assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_BOTH));
552             assertFalse(mChannelCollection.isAllChannels());
553         }
554 
555 
556         /**
557          * Add enough channels across all bands that the max channels is exceeded
558          */
559         @Test
addChannel_addAllAvailableChannels()560         public void addChannel_addAllAvailableChannels() {
561             mChannelCollection.addChannel(2412);
562             mChannelCollection.addChannel(2450);
563             mChannelCollection.addChannel(5160);
564             mChannelCollection.addChannel(5175);
565             mChannelCollection.addChannel(5600);
566             mChannelCollection.addChannel(5650);
567             mChannelCollection.addChannel(5660);
568             mChannelCollection.addChannel(5945);
569             mChannelCollection.addChannel(5985);
570             mChannelCollection.addChannel(58320);
571             mChannelCollection.addChannel(60480);
572 
573             WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
574             mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
575             assertThat(bucketSettings,
576                     channelsAre(2412, 2450,
577                             5160, 5175, 5600, 5650, 5660, 5945, 5985,
578                             58320, 60480));
579             assertTrue(mChannelCollection.isAllChannels());
580         }
581     }
582 }
583