Unit test for User Definded Plugin 54/87554/1
authorPiotr Ganicz <p.ganicz@samsung.com>
Thu, 8 Sep 2016 08:56:32 +0000 (10:56 +0200)
committerPiotr Ganicz <p.ganicz@samsung.com>
Thu, 8 Sep 2016 13:06:05 +0000 (15:06 +0200)
Change-Id: I3ca99aae0e79320941a1bb2b8ef9ee410ac75738

src/unit_tests/smoke_test.cc
src/unit_tests/test_samples/smoke/SimpleEchoPrivilege.wgt [new file with mode: 0644]

index 49905e2..4e6606e 100644 (file)
@@ -782,6 +782,24 @@ TEST_F(SmokeTest, MountUpdateMode) {
   ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/VERSION", "2\n"));
 }
 
+TEST_F(SmokeTest, UserDefinedPlugins) {
+  bf::path path = kSmokePackagesDirectory / "SimpleEchoPrivilege.wgt";
+  std::string pkgid = "0CSPVhKmRk";
+  std::string appid = "0CSPVhKmRk.SimpleEcho";
+  std::string call_privilege = "http://tizen.org/privilege/call";
+  std::string location_privilege = "http://tizen.org/privilege/location";
+  std::string power_privilege = "http://tizen.org/privilege/power";
+
+  ASSERT_EQ(Install(path, PackageType::WGT), ci::AppInstaller::Result::OK);
+  ValidatePackage(pkgid, {appid});
+  std::vector<std::string> res;
+  ASSERT_TRUE(ci::QueryPrivilegesForPkgId(pkgid, kTestUserId, &res));
+  ASSERT_TRUE(std::find(res.begin(), res.end(), call_privilege) != res.end());
+  ASSERT_TRUE(std::find(res.begin(), res.end(), location_privilege)
+          != res.end());
+  ASSERT_TRUE(std::find(res.begin(), res.end(), power_privilege) != res.end());
+}
+
 }  // namespace common_installer
 
 int main(int argc,  char** argv) {
diff --git a/src/unit_tests/test_samples/smoke/SimpleEchoPrivilege.wgt b/src/unit_tests/test_samples/smoke/SimpleEchoPrivilege.wgt
new file mode 100644 (file)
index 0000000..e48d684
Binary files /dev/null and b/src/unit_tests/test_samples/smoke/SimpleEchoPrivilege.wgt differ