1 /*
2 * Copyright (C) 2017 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 #include "gtest/gtest.h"
18
19 #include "include/utility.h"
20
TEST(ScanResultTest,ConstructOffloadScanResultBasedOnChreWifiScanResult)21 TEST(ScanResultTest, ConstructOffloadScanResultBasedOnChreWifiScanResult) {
22 wifi_offload_test::RandomGenerator random_gen;
23 chreWifiScanResult chre_scan_result;
24 init(chre_scan_result, random_gen);
25 wifi_offload::ScanResult nanoapp_scan_result(chre_scan_result);
26
27 wifi_offload::Ssid ssid;
28 ssid.SetData(chre_scan_result.ssid, chre_scan_result.ssidLen);
29 ASSERT_EQ(ssid, nanoapp_scan_result.ssid_);
30 EXPECT_EQ(chre_scan_result.securityMode, nanoapp_scan_result.security_modes_);
31 EXPECT_EQ(0, std::memcmp(chre_scan_result.bssid, nanoapp_scan_result.bssid_,
32 CHRE_WIFI_BSSID_LEN));
33 EXPECT_EQ(chre_scan_result.capabilityInfo, nanoapp_scan_result.capability_);
34 EXPECT_EQ(chre_scan_result.primaryChannel,
35 nanoapp_scan_result.frequency_scanned_mhz_);
36 EXPECT_EQ(chre_scan_result.rssi, nanoapp_scan_result.rssi_dbm_);
37 EXPECT_EQ(0, nanoapp_scan_result.tsf_);
38 }
39