LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_DEFINITIONS("-DHTTP_GTEST")
+IF(USE_LOCALHOST_SERVER)
+ MESSAGE("Use localhost server.")
+ ADD_DEFINITIONS("-DUSE_LOCALHOST_SERVER")
+ENDIF(USE_LOCALHOST_SERVER)
+
pkg_check_modules(gtest_pkgs REQUIRED gmock glib-2.0)
INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})
#include "http-gtest-util.h"
+#if defined USE_LOCALHOST_SERVER
+#define DEFAULT_TEST_URL "http://localhost"
+#else
+#define DEFAULT_TEST_URL "http://www.example.com"
+#endif
+
static bool _completed_flag;
static bool _canceled_flag;
static bool _paused_flag;
static bool _resumed_flag;
static void _completed_cb(http_transaction_h http_transaction, void *user_data);
-static void _aborted_cb(http_transaction_h http_transaction, http_error_code_e error, void *user_data);
+static void _aborted_cb(http_transaction_h http_transaction,
+ http_error_code_e error, void *user_data);
+
class HttpAsyncTest: public ::testing::Test {
protected:
http_session_h session = NULL;
http_session_open_transaction(session, HTTP_METHOD_GET, &transaction);
http_transaction_set_completed_cb(transaction, _completed_cb, NULL);
http_transaction_set_aborted_cb(transaction, _aborted_cb, NULL);
- http_transaction_request_set_uri(transaction, "http://www.example.com");
+ http_transaction_request_set_uri(transaction, DEFAULT_TEST_URL);
}
void TearDown() override