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 <boost/optional/optional.hpp>
7 #include <pkgmgr_parser.h>
9 #include <glib/glist.h>
15 #include "common/plugins/plugin.h"
16 #include "common/utils/glist_range.h"
17 #include "smoke_tests/libs/test_assessor.h"
19 namespace ci = common_installer;
23 boost::optional<std::string> CheckArgs(
28 return std::string("Package id is null for category plugin");
30 return std::string("Application id is null for category plugin");
31 if (strcmp(pkgid, ci::kTestPackageId) != 0)
32 return std::string("Package id doesn't match for category plugin");
33 if (strcmp(appid, ci::kTestApplicationId) != 0)
34 return std::string("Application id doesn't match for category plugin");
35 auto range = GListRange<__category_t*>(categories);
36 if (range.Size() != 3)
37 return std::string("Metadata Glist is wrong size for category plugin");
39 for (__category_t* category : range) {
40 if (strcmp(category->name, "http://tizen.org/category/test_category") == 0)
44 return std::string("Category value not found");
50 extern "C" int PKGMGR_CATEGORY_PARSER_PLUGIN_INSTALL(
54 ci::TestAssessor::Instance().AddResult(std::make_tuple(
55 ci::kCategoryPluginName,
56 ci::Plugin::ActionType::Install,
57 ci::Plugin::ProcessType::Main),
58 CheckArgs(pkgid, appid, categories));
62 extern "C" int PKGMGR_CATEGORY_PARSER_PLUGIN_UPGRADE(
66 ci::TestAssessor::Instance().AddResult(std::make_tuple(
67 ci::kCategoryPluginName,
68 ci::Plugin::ActionType::Upgrade,
69 ci::Plugin::ProcessType::Main),
70 CheckArgs(pkgid, appid, categories));
74 extern "C" int PKGMGR_CATEGORY_PARSER_PLUGIN_UNINSTALL(
78 ci::TestAssessor::Instance().AddResult(std::make_tuple(
79 ci::kCategoryPluginName,
80 ci::Plugin::ActionType::Uninstall,
81 ci::Plugin::ProcessType::Main),
82 CheckArgs(pkgid, appid, categories));