Removed dead code from SimpleUI
[profile/tv/apps/web/browser.git] / unit_tests / ut_coreService.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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 #include <memory>
18 #include <boost/test/unit_test.hpp>
19 #include <boost/any.hpp>
20
21 #include "ServiceManager.h"
22 #include "Services/ServiceInterface.h"
23
24 BOOST_AUTO_TEST_SUITE(core_ServiceManager)
25
26 namespace tbc=tizen_browser::core;
27
28 BOOST_AUTO_TEST_CASE(singleton)
29 {
30 //     check if service manager is singleton
31     tbc::ServiceManager *serviceManager_instance_01 = &tbc::ServiceManager::getInstance();
32     tbc::ServiceManager *serviceManager_instance_02 = &tbc::ServiceManager::getInstance();
33
34     BOOST_CHECK_EQUAL(serviceManager_instance_01, serviceManager_instance_02);
35 }
36
37 BOOST_AUTO_TEST_CASE(getService)
38 {
39     std::string serviceName("org.tizen.browser.TestServiceOne");
40     tbc::ServiceManager *servManager = &tbc::ServiceManager::getInstance();
41     std::shared_ptr<ServiceInterface> service1 = std::dynamic_pointer_cast
42     <ServiceInterface,tbc::AbstractService>
43     (servManager->getService(serviceName));
44     BOOST_REQUIRE(service1);
45     std::string nameFromService = service1->getName();
46     BOOST_CHECK_EQUAL_COLLECTIONS(nameFromService.begin(),
47                                  nameFromService.end(),
48                                  serviceName.begin(),
49                                  serviceName.end());
50 }
51
52 BOOST_AUTO_TEST_SUITE_END()
53