./ 0000755 0000156 0000165 00000000000 12675036254 011107 5 ustar jenkins jenkins ./cmake/ 0000755 0000156 0000165 00000000000 12675036254 012167 5 ustar jenkins jenkins ./cmake/GdbusCodegen.cmake 0000644 0000156 0000165 00000002465 12675036254 015531 0 ustar jenkins jenkins cmake_minimum_required(VERSION 2.6)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif(POLICY CMP0011)
find_program(GDBUS_CODEGEN NAMES gdbus-codegen DOC "gdbus-codegen executable")
if(NOT GDBUS_CODEGEN)
message(FATAL_ERROR "Excutable gdbus-codegen not found")
endif()
macro(add_gdbus_codegen outfiles name prefix service_xml)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"
COMMAND "${GDBUS_CODEGEN}"
--interface-prefix "${prefix}"
--generate-c-code "${name}"
"${service_xml}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${ARGN} "${service_xml}"
)
list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
endmacro(add_gdbus_codegen)
macro(add_gdbus_codegen_with_namespace outfiles name prefix namespace service_xml)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"
COMMAND "${GDBUS_CODEGEN}"
--interface-prefix "${prefix}"
--generate-c-code "${name}"
--c-namespace "${namespace}"
"${service_xml}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${ARGN} "${service_xml}"
)
list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
endmacro(add_gdbus_codegen_with_namespace)
./tests/ 0000755 0000156 0000165 00000000000 12675036254 012251 5 ustar jenkins jenkins ./tests/dbus-fixture.h 0000644 0000156 0000165 00000003213 12675036254 015042 0 ustar jenkins jenkins /*
* Copyright © 2015 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*
* Authors:
* Ted Gould
*/
#ifndef DBUS_FIXTURE_H
#define DBUS_FIXTURE_H
#include
#include
struct DBusFixture : public ::testing::Test
{
protected:
GDBusConnection* m_bus = nullptr;
virtual void SetUp()
{
BeforeBusSetUp();
m_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, nullptr);
g_dbus_connection_set_exit_on_close(m_bus, FALSE);
g_object_add_weak_pointer(G_OBJECT(m_bus), (gpointer*)&m_bus);
}
virtual void TearDown()
{
BeforeBusTearDown();
g_object_unref(m_bus);
unsigned int cleartry = 0;
while (m_bus != nullptr && cleartry < 100)
{
g_usleep(100000);
while (g_main_pending())
{
g_main_iteration(TRUE);
}
cleartry++;
}
ASSERT_LT(cleartry, 100);
}
virtual void BeforeBusSetUp() {}
virtual void BeforeBusTearDown() {}
};
#endif // DBUS_FIXTURE_H
./tests/libpay-iap-tests.cpp 0000644 0000156 0000165 00000026476 12675036254 016163 0 ustar jenkins jenkins /*
* Copyright © 2015 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*
* Authors:
* Charle Kerr
*/
#include "dbus-fixture.h"
#include
#include
#include