summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-04-24 13:12:15 -0700
committerRoshan Pius <rpius@google.com>2019-04-24 20:27:47 +0000
commitdba38877339a03afe388ff5af40d8efd22b74517 (patch)
treec70f677af0d0374a5be21f4592cf77d6a1cb0e0b
parenta5a61a832786071c8b830ca03a116ef9a9d6ca7b (diff)
downloadwificond-android10-qpr1-b-release.tar.gz
Bug: 130244585 Test: ./system/connectivity/wificond/runtests.sh Change-Id: I05fa9e0d98a867bb3eacda355c531f686b3a44d8
-rw-r--r--tests/mock_netlink_utils.h2
-rw-r--r--tests/scanner_unittest.cpp8
-rw-r--r--tests/server_unittest.cpp11
3 files changed, 5 insertions, 16 deletions
diff --git a/tests/mock_netlink_utils.h b/tests/mock_netlink_utils.h
index cc76fae..708a385 100644
--- a/tests/mock_netlink_utils.h
+++ b/tests/mock_netlink_utils.h
@@ -30,6 +30,8 @@ class MockNetlinkUtils : public NetlinkUtils {
~MockNetlinkUtils() override = default;
MOCK_METHOD1(GetWiphyIndex, bool(uint32_t* out_wiphy_index));
+ MOCK_METHOD2(GetWiphyIndex,
+ bool(uint32_t* out_wiphy_index, const std::string& iface_name));
MOCK_METHOD1(UnsubscribeMlmeEvent, void(uint32_t interface_index));
MOCK_METHOD1(UnsubscribeRegDomainChange, void(uint32_t wiphy_index));
MOCK_METHOD1(UnsubscribeStationEvent, void(uint32_t interface_index));
diff --git a/tests/scanner_unittest.cpp b/tests/scanner_unittest.cpp
index 8cb49b3..39a591e 100644
--- a/tests/scanner_unittest.cpp
+++ b/tests/scanner_unittest.cpp
@@ -96,7 +96,7 @@ bool CaptureSchedScanReqFlags(
const SchedScanIntervalSetting& /* interval_setting */,
int32_t /* rssi_threshold_2g */,
int32_t /* rssi_threshold_5g */,
- const SchedScanReqFlags& req_flags,
+ const SchedScanReqFlags& req_flags,
const std::vector<std::vector<uint8_t>>& /* scan_ssids */,
const std::vector<std::vector<uint8_t>>& /* match_ssids */,
const std::vector<uint32_t>& /* freqs */,
@@ -351,19 +351,15 @@ TEST_F(ScannerTest, TestStartPnoScanViaNetlinkWithLowPowerScanWiphySupport) {
wiphy_features_, &client_interface_impl_,
&scan_utils_, offload_service_utils_);
SchedScanReqFlags req_flags = {};
- ON_CALL(
- scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, _, _)).
- WillByDefault(Return(true));
EXPECT_CALL(
scan_utils_,
StartScheduledScan(_, _, _, _, _, _, _, _, _)).
WillOnce(Invoke(bind(
CaptureSchedScanReqFlags,
_1, _2, _3, _4, _5, _6, _7, _8, _9, &req_flags)));
- EXPECT_TRUE(req_flags.request_low_power);
EXPECT_TRUE(scanner_impl.startPnoScan(PnoSettings(), &success).isOk());
EXPECT_TRUE(success);
+ EXPECT_TRUE(req_flags.request_low_power);
}
TEST_F(ScannerTest, TestStopPnoScanViaNetlink) {
diff --git a/tests/server_unittest.cpp b/tests/server_unittest.cpp
index c2886c2..2175cf9 100644
--- a/tests/server_unittest.cpp
+++ b/tests/server_unittest.cpp
@@ -80,6 +80,7 @@ class ServerTest : public ::testing::Test {
void SetUp() override {
ON_CALL(*if_tool_, SetUpState(_, _)).WillByDefault(Return(true));
ON_CALL(*netlink_utils_, GetWiphyIndex(_)).WillByDefault(Return(true));
+ ON_CALL(*netlink_utils_, GetWiphyIndex(_, _)).WillByDefault(Return(true));
ON_CALL(*netlink_utils_, GetInterfaces(_, _))
.WillByDefault(Invoke(bind(
MockGetInterfacesResponse, mock_interfaces, true, _1, _2)));
@@ -155,9 +156,6 @@ TEST_F(ServerTest, CanDestroyInterfaces) {
TEST_F(ServerTest, CanTeardownApInterface) {
sp<IApInterface> ap_if;
- // When we tear down the interface, we expect the iface to be unloaded.
- EXPECT_CALL(*if_tool_, SetUpState(StrEq(kFakeInterfaceName), Eq(false)));
-
EXPECT_TRUE(server_.createApInterface(kFakeInterfaceName, &ap_if).isOk());
EXPECT_NE(nullptr, ap_if.get());
@@ -174,9 +172,6 @@ TEST_F(ServerTest, CanTeardownApInterface) {
TEST_F(ServerTest, CanTeardownClientInterface) {
sp<IClientInterface> client_if;
- // When we tear down the interface, we expect the iface to be unloaded.
- EXPECT_CALL(*if_tool_, SetUpState(StrEq(kFakeInterfaceName), Eq(false)));
-
EXPECT_TRUE(server_.createClientInterface(
kFakeInterfaceName, &client_if).isOk());
EXPECT_NE(nullptr, client_if.get());
@@ -202,10 +197,6 @@ TEST_F(ServerTest, CanCreateTeardownApAndClientInterface) {
EXPECT_TRUE(server_.createApInterface(kFakeInterfaceName1, &ap_if).isOk());
EXPECT_NE(nullptr, ap_if.get());
- // When we tear down the interfaces, we expect the iface to be unloaded.
- EXPECT_CALL(*if_tool_, SetUpState(StrEq(kFakeInterfaceName), Eq(false)));
- EXPECT_CALL(*if_tool_, SetUpState(StrEq(kFakeInterfaceName1), Eq(false)));
-
bool success = true;
// Try to remove an invalid iface name, this should fail.
EXPECT_TRUE(server_.tearDownClientInterface(