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,
44 explicit DBusTest(const std::string& name);
46 void run(unsigned int timeout);
49 void setStatus(Status status);
50 void setMessage(const std::string& message);
53 void fail(const std::string& message = std::string());
56 void OnEventReceived(const TimeoutEvent& event);
57 void OnEventReceived(const QuitEvent& event);
61 std::string m_message;
64 class DBusTestManager : private DPL::Noncopyable
67 static DBusTestManager& getInstance();
69 DBusTest& getCurrentTest() const;
70 void setCurrentTest(DBusTest& test);
80 #define DBUS_TEST(TestProc) \
81 void DBus##TestProc(); \
82 RUNNER_TEST(TestProc) \
84 DBusTest test(#TestProc); \
85 DBusTestManager::getInstance().setCurrentTest(test); \
87 DBusTestManager::getInstance().clear(); \