1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache 2.0 license that can be
3 // found in the LICENSE file.
5 #include <pkgmgr_parser.h>
7 #include <glib/glist.h>
14 #include "common/plugins/plugin.h"
15 #include "common/utils/glist_range.h"
16 #include "smoke_tests/libs/test_assessor.h"
18 namespace ci = common_installer;
22 std::optional<std::string> CheckArgs(
27 return std::string("Package id is null for category plugin");
29 return std::string("Application id is null for category plugin");
30 if (strcmp(pkgid, ci::kTestPackageId) != 0)
31 return std::string("Package id doesn't match for category plugin");
32 if (strcmp(appid, ci::kTestApplicationId) != 0)
33 return std::string("Application id doesn't match for category plugin");
34 auto range = GListRange<__category_t*>(categories);
35 if (range.Size() != 3)
36 return std::string("Metadata Glist is wrong size for category plugin");
38 for (__category_t* category : range) {
39 if (strcmp(category->name, "http://tizen.org/category/test_category") == 0)
43 return std::string("Category value not found");
49 extern "C" int PKGMGR_CATEGORY_PARSER_PLUGIN_INSTALL(
53 ci::TestAssessor::Instance().AddResult(std::make_tuple(
54 ci::kCategoryPluginName,
55 ci::Plugin::ActionType::Install,
56 ci::Plugin::ProcessType::Main),
57 CheckArgs(pkgid, appid, categories));
61 extern "C" int PKGMGR_CATEGORY_PARSER_PLUGIN_UPGRADE(
65 ci::TestAssessor::Instance().AddResult(std::make_tuple(
66 ci::kCategoryPluginName,
67 ci::Plugin::ActionType::Upgrade,
68 ci::Plugin::ProcessType::Main),
69 CheckArgs(pkgid, appid, categories));
73 extern "C" int PKGMGR_CATEGORY_PARSER_PLUGIN_UNINSTALL(
77 ci::TestAssessor::Instance().AddResult(std::make_tuple(
78 ci::kCategoryPluginName,
79 ci::Plugin::ActionType::Uninstall,
80 ci::Plugin::ProcessType::Main),
81 CheckArgs(pkgid, appid, categories));