Fix crash while running unit-test 86/255586/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Fri, 19 Mar 2021 09:11:36 +0000 (18:11 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Fri, 19 Mar 2021 09:11:36 +0000 (18:11 +0900)
Change-Id: If7535826e08024462c48968e217c7387081549ea
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
test/unit_tests/test_theme.cc

index 3e81e8d..2bd0937 100644 (file)
@@ -500,6 +500,21 @@ TEST_F(ThemeTest, Theme_GetPath_N) {
   int ret = theme_get_path(nullptr, "/preview", &path);
   EXPECT_EQ(ret, THEME_MANAGER_ERROR_INVALID_PARAMETER);
 
+  int handle1 = 1;
+  EXPECT_CALL(GetMock<PkgmgrInfoMock>(),
+      pkgmgrinfo_pkginfo_get_usr_pkginfo(StrEq("testpkgid"), _, _)).
+          WillOnce(DoAll(
+                  SetArgPointee<2>(
+                      reinterpret_cast<pkgmgrinfo_pkginfo_h>(handle1)),
+                  Return(PMINFO_R_OK)));
+  char root_path1[] = "/opt/usr/globalapps/test_pkgid";
+  EXPECT_CALL(GetMock<PkgmgrInfoMock>(),
+      pkgmgrinfo_pkginfo_get_root_path(
+          reinterpret_cast<pkgmgrinfo_pkginfo_h>(handle1), _)).
+          WillOnce(DoAll(
+                  SetArgPointee<1>(const_cast<char*>(root_path1)),
+                  Return(PMINFO_R_OK)));
+
   std::shared_ptr<ThemeInfo> info(new ThemeInfo(b_));
   theme_h handle = static_cast<void*>(&info);
   ret = theme_get_path(handle, "/not/exist/key", &path);