2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "utils/HttpHeader.h"
22 #include "gtest/gtest.h"
24 TEST(TestHttpHeader, General)
27 std::string str = "Host: xbmc.org\r\n"
28 "Accept: text/*, text/html, text/html;level=1, */*\r\n"
29 "Accept-Language: en\r\n"
30 "Accept-Encoding: gzip, deflate\r\n"
31 "Content-Type: text/html; charset=ISO-8859-4\r\n"
32 "User-Agent: XBMC/snapshot (compatible; MSIE 5.5; Windows NT"
34 "Connection: Keep-Alive\r\n";
35 std::string refstr, varstr;
39 /* Should be in the same order as above */
42 "accept: text/*, text/html, text/html;level=1, */*\n"
43 "accept-language: en\n"
44 "accept-encoding: gzip, deflate\n"
45 "content-type: text/html; charset=ISO-8859-4\n"
46 "user-agent: XBMC/snapshot (compatible; MSIE 5.5; Windows NT 4.0)\n"
47 "connection: Keep-Alive\n"
50 varstr = a.GetHeader();
51 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
53 refstr = "XBMC/snapshot (compatible; MSIE 5.5; Windows NT 4.0)";
54 varstr = a.GetValue("User-Agent");
55 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
57 /* No charset should be here */
59 varstr = a.GetMimeType();
60 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
63 varstr = a.GetProtoLine();
64 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
68 varstr = a.GetMimeType();
69 EXPECT_STREQ(refstr.c_str(), varstr.c_str());