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"
23 #include "gtest/gtest.h"
25 TEST(TestHttpHeader, General)
28 CStdString str = "Host: xbmc.org\r\n"
29 "Accept: text/*, text/html, text/html;level=1, */*\r\n"
30 "Accept-Language: en\r\n"
31 "Accept-Encoding: gzip, deflate\r\n"
32 "Content-Type: text/html; charset=ISO-8859-4\r\n"
33 "User-Agent: XBMC/snapshot (compatible; MSIE 5.5; Windows NT"
35 "Connection: Keep-Alive\r\n";
36 CStdString refstr, varstr;
40 refstr = "accept: text/*, text/html, text/html;level=1, */*\n"
41 "accept-encoding: gzip, deflate\n"
42 "accept-language: en\n"
43 "connection: Keep-Alive\n"
44 "content-type: text/html; charset=ISO-8859-4\n"
46 "user-agent: XBMC/snapshot (compatible; MSIE 5.5; Windows NT 4.0)\n"
50 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
52 refstr = "XBMC/snapshot (compatible; MSIE 5.5; Windows NT 4.0)";
53 varstr = a.GetValue("User-Agent");
54 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
56 refstr = "text/html; charset=ISO-8859-4";
57 varstr = a.GetMimeType();
58 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
61 varstr = a.GetProtoLine();
62 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
66 varstr = a.GetMimeType();
67 EXPECT_STREQ(refstr.c_str(), varstr.c_str());