1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include <vector>
- #include <gtest/gtest.h>
- #include "wificond/scanning/offload/scan_stats.h"
- #include "wificond/tests/offload_hal_test_constants.h"
- using ::com::android::server::wifi::wificond::NativeScanStats;
- using namespace android::wificond::offload_hal_test_constants;
- namespace android {
- namespace wificond {
- class ScanStatsTest : public ::testing::Test {};
- TEST_F(ScanStatsTest, ParcelableTest) {
- std::vector<uint8_t> histogram_channels;
- for (size_t i = 0; i < kNumChannelsInHistogram; i++) {
- histogram_channels.push_back(kNumChannelsInHistogram - 1 - i);
- }
- NativeScanStats scan_stats_in(kDefaultNumScansRequestedByWifi,
- kDefaultNumScansServicedByWifi,
- kScanDurationTotalMs, kSubscriptionDurationMs,
- kNumChannelsTotalScanned, histogram_channels);
- Parcel parcel;
- EXPECT_EQ(::android::OK, scan_stats_in.writeToParcel(&parcel));
- NativeScanStats scan_stats_out;
- parcel.setDataPosition(0);
- EXPECT_EQ(::android::OK, scan_stats_out.readFromParcel(&parcel));
- EXPECT_TRUE(scan_stats_in == scan_stats_out);
- }
- }
- }
|