2 * Copyright (C) 2005-2012 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, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #include "utils/HttpHeader.h"
24 #include "gtest/gtest.h"
26 TEST(TestHttpHeader, General)
29 CStdString str = "Host: xbmc.org\r\n"
30 "Accept: text/*, text/html, text/html;level=1, */*\r\n"
31 "Accept-Language: en\r\n"
32 "Accept-Encoding: gzip, deflate\r\n"
33 "Content-Type: text/html; charset=ISO-8859-4\r\n"
34 "User-Agent: XBMC/snapshot (compatible; MSIE 5.5; Windows NT"
36 "Connection: Keep-Alive\r\n";
37 CStdString refstr, varstr;
41 refstr = "accept: text/*, text/html, text/html;level=1, */*\n"
42 "accept-encoding: gzip, deflate\n"
43 "accept-language: en\n"
44 "connection: Keep-Alive\n"
45 "content-type: text/html; charset=ISO-8859-4\n"
47 "user-agent: XBMC/snapshot (compatible; MSIE 5.5; Windows NT 4.0)\n"
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 refstr = "text/html; charset=ISO-8859-4";
58 varstr = a.GetMimeType();
59 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
62 varstr = a.GetProtoLine();
63 EXPECT_STREQ(refstr.c_str(), varstr.c_str());
67 varstr = a.GetMimeType();
68 EXPECT_STREQ(refstr.c_str(), varstr.c_str());