• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 <gtest/gtest.h>
17 #include <gmock/gmock.h>
18 
19 #define private public
20 #include "process_skeleton.h"
21 #include "ipc_types.h"
22 #include "iremote_object.h"
23 #include "ipc_object_stub.h"
24 #undef private
25 
26 using namespace testing::ext;
27 using namespace OHOS;
28 
29 class ProcessSkeletonUnitTest : public testing::Test {
30 public:
31     static void SetUpTestCase(void);
32     static void TearDownTestCase(void);
33     void SetUp();
34     void TearDown();
35 };
36 
SetUpTestCase()37 void ProcessSkeletonUnitTest::SetUpTestCase()
38 {
39 }
40 
TearDownTestCase()41 void ProcessSkeletonUnitTest::TearDownTestCase()
42 {
43 }
44 
SetUp()45 void ProcessSkeletonUnitTest::SetUp() {}
46 
TearDown()47 void ProcessSkeletonUnitTest::TearDown() {}
48 
49 /**
50  * @tc.name: IsContainsObjectTest001
51  * @tc.desc: Verify the IsContainsObject function
52  * @tc.type: FUNC
53  */
54 HWTEST_F(ProcessSkeletonUnitTest, IsContainsObjectTest001, TestSize.Level1)
55 {
56     ProcessSkeleton *skeleton = ProcessSkeleton::GetInstance();
57     ASSERT_TRUE(skeleton != nullptr);
58 
59     sptr<IRemoteObject> object = new IPCObjectStub(u"testObject");
60     skeleton->isContainStub_.clear();
61     bool ret = skeleton->IsContainsObject(object.GetRefPtr());
62     EXPECT_EQ(ret, false);
63 }
64