summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorin Apostol <florin.apostol@oregan.net>2016-02-16 14:26:55 +0000
committerThiago Santos <thiagoss@osg.samsung.com>2016-04-22 17:33:15 -0300
commit00a74e98b3ed0dfd3b621049a8bdca70cc025ca2 (patch)
tree2bf963e4d408856d4d2f1296295fab26ab8ec9a8 /tests
parent3224cfd0b5569d5edd2fd617210fa91b4d201fee (diff)
adaptivedemux: tests: use macro to define names of request and response structs
Following the Don't Repeat Yourself principle, define macros for the structures that contain the request and response headers, so that the name is not repeated in multiple places in multiple files. https://bugzilla.gnome.org/show_bug.cgi?id=762144
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/test_http_src.c14
-rw-r--r--tests/check/elements/test_http_src.h14
2 files changed, 22 insertions, 6 deletions
diff --git a/tests/check/elements/test_http_src.c b/tests/check/elements/test_http_src.c
index 09fc9b14d..14f204314 100644
--- a/tests/check/elements/test_http_src.c
+++ b/tests/check/elements/test_http_src.c
@@ -314,7 +314,8 @@ gst_test_http_src_start (GstBaseSrc * basesrc)
http_headers = gst_structure_new_empty ("http-headers");
gst_structure_set (http_headers, "uri", G_TYPE_STRING, src->uri, NULL);
if (!src->input.request_headers) {
- src->input.request_headers = gst_structure_new_empty ("request-headers");
+ src->input.request_headers =
+ gst_structure_new_empty (TEST_HTTP_SRC_REQUEST_HEADERS_NAME);
}
if (!gst_structure_has_field_typed (src->input.request_headers,
"User-Agent", G_TYPE_STRING)) {
@@ -334,10 +335,11 @@ gst_test_http_src_start (GstBaseSrc * basesrc)
gst_structure_set (src->input.request_headers, "Accept-Encoding",
G_TYPE_STRING, "compress, gzip", NULL);
}
- gst_structure_set (http_headers, "request-headers", GST_TYPE_STRUCTURE,
- src->input.request_headers, NULL);
+ gst_structure_set (http_headers, TEST_HTTP_SRC_REQUEST_HEADERS_NAME,
+ GST_TYPE_STRUCTURE, src->input.request_headers, NULL);
if (!src->input.response_headers) {
- src->input.response_headers = gst_structure_new_empty ("response-headers");
+ src->input.response_headers =
+ gst_structure_new_empty (TEST_HTTP_SRC_RESPONSE_HEADERS_NAME);
}
if (!gst_structure_has_field_typed (src->input.response_headers,
"Connection", G_TYPE_STRING)) {
@@ -359,8 +361,8 @@ gst_test_http_src_start (GstBaseSrc * basesrc)
g_free (date_str);
g_date_time_unref (now);
}
- gst_structure_set (http_headers, "response-headers", GST_TYPE_STRUCTURE,
- src->input.response_headers, NULL);
+ gst_structure_set (http_headers, TEST_HTTP_SRC_RESPONSE_HEADERS_NAME,
+ GST_TYPE_STRUCTURE, src->input.response_headers, NULL);
if (src->http_headers_event) {
gst_event_unref (src->http_headers_event);
}
diff --git a/tests/check/elements/test_http_src.h b/tests/check/elements/test_http_src.h
index 61161afb4..3a83e2537 100644
--- a/tests/check/elements/test_http_src.h
+++ b/tests/check/elements/test_http_src.h
@@ -27,6 +27,20 @@ G_BEGIN_DECLS
#define GST_TYPE_TEST_HTTP_SRC (gst_test_http_src_get_type ())
+/**
+ * TEST_HTTP_SRC_REQUEST_HEADERS_NAME:
+ * The name of the #GstStructure that will contain all the HTTP request
+ * headers
+ */
+#define TEST_HTTP_SRC_REQUEST_HEADERS_NAME "request-headers"
+
+/**
+ * TEST_HTTP_SRC_RESPONSE_HEADERS_NAME:
+ * The name of the #GstStructure that will contain all the HTTP response
+ * headers
+ */
+#define TEST_HTTP_SRC_RESPONSE_HEADERS_NAME "response-headers"
+
/* structure used by src_start function to configure the
* GstTestHTTPSrc plugin.
* It specifies information about a given URI.