mirror of
https://gitee.com/openharmony/bundlemanager_app_domain_verify
synced 2025-01-16 05:28:33 +00:00
commit
9333075c70
@ -171,4 +171,29 @@ HWTEST_F(AppDomainVerifyTaskMgrTest, AppDomainVerifyTaskMgrTest006, TestSize.Lev
|
||||
Sleep();
|
||||
ASSERT_TRUE(appDomainVerifyTaskMgr->IsIdle());
|
||||
}
|
||||
class BaseHttpTask : public IHttpTask {
|
||||
public:
|
||||
std::shared_ptr<OHOS::NetStack::HttpClient::HttpClientTask> CreateHttpClientTask() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @tc.name: AppDomainVerifyTaskMgrTest007
|
||||
* @tc.desc: on date cancle
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(AppDomainVerifyTaskMgrTest, AppDomainVerifyTaskMgrTest007, TestSize.Level0)
|
||||
{
|
||||
std::shared_ptr<BaseHttpTask> baseHttpTask = std::make_shared<BaseHttpTask>();
|
||||
HttpClientRequest request;
|
||||
HttpClientResponse response;
|
||||
HttpClientError error;
|
||||
uint8_t* data;
|
||||
baseHttpTask->OnSuccess(request, response);
|
||||
baseHttpTask->OnFail(request, response, error);
|
||||
baseHttpTask->OnCancel(request, response);
|
||||
baseHttpTask->OnDataReceive(nullptr, request, data, 0);
|
||||
ASSERT_TRUE(baseHttpTask->CreateHttpClientTask() == nullptr);
|
||||
}
|
||||
}
|
@ -48,6 +48,7 @@ ohos_unittest("app_domain_verify_agent_verifier_test") {
|
||||
sources = [
|
||||
"${app_domain_verify_verifier_path}/src/domain_json_util.cpp",
|
||||
"${app_domain_verify_verifier_path}/src/domain_verifier.cpp",
|
||||
"${app_domain_verify_verifier_path}/src/verify_http_task.cpp",
|
||||
"${app_domain_verify_verifier_path}/src/verify_task.cpp",
|
||||
"domain_json_util_test.cpp",
|
||||
"domain_verifier_test.cpp",
|
||||
|
@ -20,6 +20,7 @@
|
||||
#undef private
|
||||
#undef protected
|
||||
#include "moc_verify_task.h"
|
||||
#include "verify_http_task.h"
|
||||
namespace OHOS::AppDomainVerify {
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
@ -217,4 +218,32 @@ HWTEST_F(DomainVerifierTaskTest, DomainVerifierTaskSaveResultTest002, TestSize.L
|
||||
|
||||
task.OnSaveVerifyResult();
|
||||
}
|
||||
/**
|
||||
* @tc.name: DomainVerifierHttpTaskTest001
|
||||
* @tc.desc:
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DomainVerifierTaskTest, DomainVerifierHttpTaskTest001, TestSize.Level0)
|
||||
{
|
||||
AppVerifyBaseInfo appVerifyBaseInfo;
|
||||
appVerifyBaseInfo.bundleName = "";
|
||||
appVerifyBaseInfo.fingerprint = "";
|
||||
appVerifyBaseInfo.appIdentifier = "";
|
||||
SkillUri uri1;
|
||||
uri1.scheme = "https";
|
||||
uri1.host = "e";
|
||||
const std::vector<SkillUri> skillUris;
|
||||
std::shared_ptr<MocVerifyTask> task = std::make_shared<MocVerifyTask>(
|
||||
TaskType::IMMEDIATE_TASK, appVerifyBaseInfo, skillUris);
|
||||
std::shared_ptr<VerifyHttpTask> verifyHttpTask = std::make_shared<VerifyHttpTask>("", task);
|
||||
OHOS::NetStack::HttpClient::HttpClientRequest request;
|
||||
OHOS::NetStack::HttpClient::HttpClientResponse response;
|
||||
OHOS::NetStack::HttpClient::HttpClientError error;
|
||||
uint8_t* data;
|
||||
verifyHttpTask->OnSuccess(request, response);
|
||||
verifyHttpTask->OnFail(request, response, error);
|
||||
verifyHttpTask->OnCancel(request, response);
|
||||
verifyHttpTask->OnDataReceive(nullptr, request, data, 0);
|
||||
ASSERT_TRUE(verifyHttpTask->CreateHttpClientTask() != nullptr);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user