• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "thermal_mock_stub_test.h"
17 
18 #include "mock_thermal_remote_object.h"
19 #include "thermal_action_callback_stub.h"
20 #include "thermal_level_callback_stub.h"
21 #include "thermal_log.h"
22 #include "thermal_mgr_errors.h"
23 #include "thermal_srv_stub.h"
24 #include "thermal_temp_callback_stub.h"
25 
26 using namespace testing::ext;
27 using namespace OHOS::PowerMgr;
28 using namespace OHOS;
29 using namespace std;
30 
31 namespace {
32 /**
33  * @tc.name: ThermalMockStubTest001
34  * @tc.desc: proxy test
35  * @tc.type: FUNC
36  * @tc.require: issueI5YZQ2
37  */
38 HWTEST_F(ThermalMockStubTest, ThermalMockStubTest001, TestSize.Level0)
39 {
40     THERMAL_HILOGD(LABEL_TEST, "ThermalMockStubTest001 start.");
41     uint32_t code = 0;
42     MessageParcel data;
43     MessageParcel reply;
44     MessageOption option;
45     sptr<ThermalActionCallbackStub> actionStub = new ThermalActionCallbackStub();
46     EXPECT_EQ(false, actionStub == nullptr);
47     EXPECT_EQ(E_GET_THERMAL_SERVICE_FAILED, actionStub->OnRemoteRequest(code, data, reply, option));
48     sptr<ThermalLevelCallbackStub> levelStub = new ThermalLevelCallbackStub();
49     EXPECT_EQ(false, levelStub == nullptr);
50     EXPECT_EQ(E_GET_THERMAL_SERVICE_FAILED, levelStub->OnRemoteRequest(code, data, reply, option));
51     sptr<ThermalTempCallbackStub> tempStub = new ThermalTempCallbackStub();
52     EXPECT_EQ(false, tempStub == nullptr);
53     EXPECT_EQ(E_GET_THERMAL_SERVICE_FAILED, tempStub->OnRemoteRequest(code, data, reply, option));
54     THERMAL_HILOGD(LABEL_TEST, "ThermalMockStubTest001 end.");
55 }
56 } // namespace
57