2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
19 * @brief Header file for DBusTest and DBusTestManager.
22 #ifndef WRT_TESTS_DBUS_TESTS_DBUS_TEST_H
23 #define WRT_TESTS_DBUS_TESTS_DBUS_TEST_H
26 #include <dpl/event/controller.h>
27 #include <dpl/generic_event.h>
29 DECLARE_GENERIC_EVENT_0(QuitEvent)
30 DECLARE_GENERIC_EVENT_0(TimeoutEvent)
33 private DPL::Event::Controller<DPL::TypeListDecl<QuitEvent, TimeoutEvent>::Type>
43 explicit DBusTest(const std::string& name);
45 void run(unsigned int timeout);
48 void setStatus(Status status);
49 void setMessage(const std::string& message);
52 void fail(const std::string& message = std::string());
55 void OnEventReceived(const TimeoutEvent& event);
56 void OnEventReceived(const QuitEvent& event);
60 std::string m_message;
63 class DBusTestManager : private DPL::Noncopyable
66 static DBusTestManager& getInstance();
68 DBusTest& getCurrentTest() const;
69 void setCurrentTest(DBusTest& test);
79 #define DBUS_TEST(TestProc) \
80 void DBus##TestProc(); \
81 RUNNER_TEST(TestProc) \
83 DBusTest test(#TestProc); \
84 DBusTestManager::getInstance().setCurrentTest(test); \
86 DBusTestManager::getInstance().clear(); \