[Release] wrt-installer_0.1.9
[framework/web/wrt-installer.git] / tests / general / NPluginsInstallTests.cpp
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file    TestCases.cpp
18  * @author  Karol Pawlowski (k.pawlowski@samsung.com)
19  * @author  Tomasz Iwanek (t.iwanek@samsung.com)
20  * @version 1.0
21  * @brief   NPlugins installation test's bodies
22  */
23
24 #include <string>
25 #include <dpl/test/test_runner.h>
26 #include <InstallerWrapper.h>
27
28 using namespace InstallerWrapper;
29
30 ////////////////////////////////////////////////////////////////////////////////
31
32 RUNNER_TEST_GROUP_INIT(NPluginsInstall)
33
34 /*
35 Name: pluginFilesAdded
36 Description: Tests installation of plugins attached to widget
37 Expected: widget should be succesfully installed
38 */
39 RUNNER_TEST(pluginFilesAdded)
40 {
41     std::string tizenId;
42     RUNNER_ASSERT(install(miscWidgetsStuff
43             + "widgets/inst_nplug_1.wgt", tizenId) == InstallerWrapper::Success);
44     uninstall(tizenId);
45 }
46
47 /*
48 Name: emptyPluginsDir
49 Description: Tests installation with empty 'plugins' directory
50 Expected: widget should be not installed
51 */
52 RUNNER_TEST(emptyPluginsDir)
53 {
54     std::string tizenId;
55     if(install(miscWidgetsStuff + "widgets/inst_nplug_2.wgt",
56             tizenId) == InstallerWrapper::Success) {
57         uninstall(tizenId);
58         RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
59     }
60 }
61
62 /*
63 Name: pluginFileAndOtherFile
64 Description: Tests installation with plugins directory and data files
65 Expected: widget should be installed
66 */
67 RUNNER_TEST(pluginFileAndOtherFile)
68 {
69     std::string tizenId;
70     RUNNER_ASSERT(install(miscWidgetsStuff
71             + "widgets/inst_nplug_3.wgt", tizenId) == InstallerWrapper::Success);
72     uninstall(tizenId);
73 }
74
75 /*
76 Name: pluginFileAndSubdir
77 Description: Tests installation with 'plugins' directory and subdirectories
78  inside plugin directory
79 Expected: widget should be not installed
80 */
81 RUNNER_TEST(pluginFileAndSubdir)
82 {
83     std::string tizenId;
84     if(install(miscWidgetsStuff + "widgets/inst_nplug_4.wgt",
85             tizenId) == InstallerWrapper::Success) {
86         uninstall(tizenId);
87         RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
88     }
89 }