2 * Copyright (C) 2016, The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include <gtest/gtest.h>
19 #include "wificond/scanning/channel_settings.h"
20 #include "wificond/scanning/hidden_network.h"
22 using ::com::android::server::wifi::wificond::ChannelSettings;
23 using ::com::android::server::wifi::wificond::HiddenNetwork;
30 const uint8_t kFakeSsid[] =
31 {'G', 'o', 'o', 'g', 'l', 'e', 'G', 'u', 'e', 's', 't'};
33 constexpr uint32_t kFakeFrequency = 5260;
37 class ScanSettingsTest : public ::testing::Test {
40 TEST_F(ScanSettingsTest, ChannelSettingsParcelableTest) {
41 ChannelSettings channel_settings;
42 channel_settings.frequency_ = kFakeFrequency;
45 EXPECT_EQ(::android::OK, channel_settings.writeToParcel(&parcel));
47 ChannelSettings channel_settings_copy;
48 parcel.setDataPosition(0);
49 EXPECT_EQ(::android::OK, channel_settings_copy.readFromParcel(&parcel));
51 EXPECT_EQ(channel_settings, channel_settings_copy);
54 TEST_F(ScanSettingsTest, HiddenNetworkParcelableTest) {
55 HiddenNetwork hidden_network;
56 hidden_network.ssid_ =
57 std::vector<uint8_t>(kFakeSsid, kFakeSsid + sizeof(kFakeSsid));
60 EXPECT_EQ(::android::OK, hidden_network.writeToParcel(&parcel));
62 HiddenNetwork hidden_network_copy;
63 parcel.setDataPosition(0);
64 EXPECT_EQ(::android::OK, hidden_network_copy.readFromParcel(&parcel));
66 EXPECT_EQ(hidden_network, hidden_network_copy);
70 } // namespace wificond
71 } // namespace android