2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <boost/test/unit_test.hpp>
19 #include <boost/any.hpp>
21 #include "ServiceManager.h"
22 #include "Services/ServiceInterface.h"
24 BOOST_AUTO_TEST_SUITE(core_ServiceManager)
26 namespace tbc=tizen_browser::core;
28 BOOST_AUTO_TEST_CASE(singleton)
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();
34 BOOST_CHECK_EQUAL(serviceManager_instance_01, serviceManager_instance_02);
37 BOOST_AUTO_TEST_CASE(getService)
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(),
52 BOOST_AUTO_TEST_SUITE_END()