Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
TestHttpHeader.cpp File Reference
#include "utils/HttpHeader.h"
#include <string.h>
#include <gtest/gtest.h>

Macros

#define CHECK_CNT_TYPE_NAME   "Content-Type"
 
#define CHECK_CONTENT_TYPE_HTML   "text/html"
 
#define CHECK_CONTENT_TYPE_HTML_CHRS   "text/html; charset=WINDOWS-1251"
 
#define CHECK_CONTENT_TYPE_XML_CHRS   "text/xml; charset=uTf-8"
 
#define CHECK_CONTENT_TYPE_TEXT   "text/plain"
 
#define CHECK_DATE_NAME   "Date"
 
#define CHECK_DATE_VALUE1   "Thu, 09 Jan 2014 17:58:30 GMT"
 
#define CHECK_DATE_VALUE2   "Thu, 09 Jan 2014 20:21:20 GMT"
 
#define CHECK_DATE_VALUE3   "Thu, 09 Jan 2014 20:25:02 GMT"
 
#define CHECK_PROT_LINE_200   "HTTP/1.1 200 OK"
 
#define CHECK_PROT_LINE_301   "HTTP/1.1 301 Moved Permanently"
 
#define CHECK_HEADER_SMPL
 
#define CHECK_HEADER_L1
 
#define CHECK_HEADER_R
 
#define CHECK_HEADER_L2
 

Functions

std::string strReplace (const std::string &str, const std::string &from, const std::string &to)
 
 TEST (TestHttpHeader, General)
 
 TEST (TestHttpHeader, Parse)
 
 TEST (TestHttpHeader, Parse_Multiline)
 
 TEST (TestHttpHeader, GetValue)
 
 TEST (TestHttpHeader, GetValues)
 
 TEST (TestHttpHeader, AddParam)
 
 TEST (TestHttpHeader, GetMimeType)
 
 TEST (TestHttpHeader, GetCharset)
 

Macro Definition Documentation

◆ CHECK_CNT_TYPE_NAME

#define CHECK_CNT_TYPE_NAME   "Content-Type"

◆ CHECK_CONTENT_TYPE_HTML

#define CHECK_CONTENT_TYPE_HTML   "text/html"

◆ CHECK_CONTENT_TYPE_HTML_CHRS

#define CHECK_CONTENT_TYPE_HTML_CHRS   "text/html; charset=WINDOWS-1251"

◆ CHECK_CONTENT_TYPE_TEXT

#define CHECK_CONTENT_TYPE_TEXT   "text/plain"

◆ CHECK_CONTENT_TYPE_XML_CHRS

#define CHECK_CONTENT_TYPE_XML_CHRS   "text/xml; charset=uTf-8"

◆ CHECK_DATE_NAME

#define CHECK_DATE_NAME   "Date"

◆ CHECK_DATE_VALUE1

#define CHECK_DATE_VALUE1   "Thu, 09 Jan 2014 17:58:30 GMT"

◆ CHECK_DATE_VALUE2

#define CHECK_DATE_VALUE2   "Thu, 09 Jan 2014 20:21:20 GMT"

◆ CHECK_DATE_VALUE3

#define CHECK_DATE_VALUE3   "Thu, 09 Jan 2014 20:25:02 GMT"

◆ CHECK_HEADER_L1

#define CHECK_HEADER_L1
Value:
"Server: nginx/1.4.4\r\n" \
"Transfer-Encoding: chunked\r\n" \
"Connection: close\r\n" \
"Set-Cookie: PHPSESSID=90857d437518db8f0944ca012761048a; path=/; domain=example.com\r\n" \
"Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n" \
"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n" \
"Pragma: no-cache\r\n" \
"Set-Cookie: user_country=ot; expires=Thu, 09-Jan-2014 18:58:30 GMT; path=/; domain=.example.com\r\n" \
"\r\n"
#define CHECK_PROT_LINE_200
Definition TestHttpHeader.cpp:24
#define CHECK_CNT_TYPE_NAME
Definition TestHttpHeader.cpp:15
#define CHECK_DATE_NAME
Definition TestHttpHeader.cpp:20
#define CHECK_CONTENT_TYPE_HTML_CHRS
Definition TestHttpHeader.cpp:17
#define CHECK_DATE_VALUE1
Definition TestHttpHeader.cpp:21

◆ CHECK_HEADER_L2

#define CHECK_HEADER_L2
Value:
"Server: Apache/2.4.7 (Unix) mod_wsgi/3.4 Python/2.7.5 OpenSSL/1.0.1e\r\n" \
"Last-Modified: Thu, 09 Jan 2014 20:10:28 GMT\r\n" \
"ETag: \"9a97-4ef8f335ebd10\"\r\n" \
"Accept-Ranges: bytes\r\n" \
"Content-Length: 33355\r\n" \
"Vary: Accept-Encoding\r\n" \
"Cache-Control: max-age=3600\r\n" \
"Expires: Thu, 09 Jan 2014 21:25:02 GMT\r\n" \
"Connection: close\r\n" \
"\r\n"
#define CHECK_CONTENT_TYPE_XML_CHRS
Definition TestHttpHeader.cpp:18
#define CHECK_DATE_VALUE3
Definition TestHttpHeader.cpp:23

◆ CHECK_HEADER_R

#define CHECK_HEADER_R
Value:
"Server: nginx/1.4.4\r\n" \
"Content-Length: 150\r\n" \
"Connection: close\r\n" \
"Location: http://www.Example.Com\r\n" \
"\r\n"
#define CHECK_CONTENT_TYPE_HTML
Definition TestHttpHeader.cpp:16
#define CHECK_PROT_LINE_301
Definition TestHttpHeader.cpp:25
#define CHECK_DATE_VALUE2
Definition TestHttpHeader.cpp:22

◆ CHECK_HEADER_SMPL

#define CHECK_HEADER_SMPL
Value:

◆ CHECK_PROT_LINE_200

#define CHECK_PROT_LINE_200   "HTTP/1.1 200 OK"

◆ CHECK_PROT_LINE_301

#define CHECK_PROT_LINE_301   "HTTP/1.1 301 Moved Permanently"

Function Documentation

◆ strReplace()

std::string strReplace ( const std::string & str,
const std::string & from,
const std::string & to )

◆ TEST() [1/8]

TEST ( TestHttpHeader ,
AddParam  )

◆ TEST() [2/8]

TEST ( TestHttpHeader ,
General  )

◆ TEST() [3/8]

TEST ( TestHttpHeader ,
GetCharset  )

◆ TEST() [4/8]

TEST ( TestHttpHeader ,
GetMimeType  )

◆ TEST() [5/8]

TEST ( TestHttpHeader ,
GetValue  )

◆ TEST() [6/8]

TEST ( TestHttpHeader ,
GetValues  )

◆ TEST() [7/8]

TEST ( TestHttpHeader ,
Parse  )

◆ TEST() [8/8]

TEST ( TestHttpHeader ,
Parse_Multiline  )