Merge "supplicant(vts): Remove dependency on libwifi_hal" into oc-dr1-dev

am: be3cb04f37

Change-Id: I69f176ee7b671e1d1f942372cd47b3ae8abd258f
This commit is contained in:
Roshan Pius 2017-07-14 20:48:46 +00:00 committed by android-build-merger
commit 0bf562c1b2
2 changed files with 17 additions and 12 deletions

View file

@ -27,17 +27,18 @@ LOCAL_SRC_FILES := \
supplicant_sta_network_hidl_test.cpp
LOCAL_SHARED_LIBRARIES := \
android.hardware.wifi.supplicant@1.0 \
android.hardware.wifi@1.0 \
libbase \
libcutils \
libhidlbase \
libhidltransport \
liblog \
libutils \
libwifi-hal \
libwifi-system \
libwifi-system-iface
LOCAL_STATIC_LIBRARIES := \
libgmock \
VtsHalHidlTargetTestBase
VtsHalHidlTargetTestBase \
VtsHalWifiV1_0TargetTestUtil
include $(BUILD_NATIVE_TEST)

View file

@ -21,11 +21,11 @@
#include <android/hidl/manager/1.0/IServiceNotification.h>
#include <hidl/HidlTransportSupport.h>
#include <wifi_hal/driver_tool.h>
#include <wifi_system/interface_tool.h>
#include <wifi_system/supplicant_manager.h>
#include "supplicant_hidl_test_utils.h"
#include "wifi_hidl_test_utils.h"
using ::android::sp;
using ::android::hardware::configureRpcThreadpool;
@ -34,6 +34,8 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::wifi::V1_0::ChipModeId;
using ::android::hardware::wifi::V1_0::IWifiChip;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicant;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantIface;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantNetwork;
@ -44,22 +46,25 @@ using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
using ::android::hidl::manager::V1_0::IServiceNotification;
using ::android::wifi_hal::DriverTool;
using ::android::wifi_system::InterfaceTool;
using ::android::wifi_system::SupplicantManager;
namespace {
const char kSupplicantServiceName[] = "default";
// Helper function to initialize the driver and firmware to STA mode.
// Helper function to initialize the driver and firmware to STA mode
// using the vendor HAL HIDL interface.
void initilializeDriverAndFirmware() {
DriverTool driver_tool;
InterfaceTool iface_tool;
EXPECT_TRUE(driver_tool.LoadDriver());
EXPECT_TRUE(driver_tool.ChangeFirmwareMode(DriverTool::kFirmwareModeSta));
EXPECT_TRUE(iface_tool.SetWifiUpState(true));
sp<IWifiChip> wifi_chip = getWifiChip();
ChipModeId mode_id;
EXPECT_TRUE(configureChipToSupportIfaceType(
wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA, &mode_id));
}
// Helper function to deinitialize the driver and firmware
// using the vendor HAL HIDL interface.
void deInitilializeDriverAndFirmware() { stopWifi(); }
// Helper function to find any iface of the desired type exposed.
bool findIfaceOfType(sp<ISupplicant> supplicant, IfaceType desired_type,
ISupplicant::IfaceInfo* out_info) {
@ -149,11 +154,10 @@ void startWifiFramework() {
}
void stopSupplicant() {
DriverTool driver_tool;
SupplicantManager supplicant_manager;
ASSERT_TRUE(supplicant_manager.StopSupplicant());
ASSERT_TRUE(driver_tool.UnloadDriver());
deInitilializeDriverAndFirmware();
ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
}