Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: net/server/http_server_response_info_unittest.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/server/http_server_response_info.cc ('k') | net/server/http_server_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/http/http_status_code.h"
6 #include "net/server/http_server_response_info.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace net {
10
11 TEST(HttpServerResponseInfoTest, StatusLine) {
12 HttpServerResponseInfo response;
13 ASSERT_EQ(HTTP_OK, response.status_code());
14 ASSERT_EQ("HTTP/1.1 200 OK\r\n\r\n", response.Serialize());
15 }
16
17 TEST(HttpServerResponseInfoTest, Headers) {
18 HttpServerResponseInfo response;
19 response.AddHeader("A", "1");
20 response.AddHeader("A", "2");
21 ASSERT_EQ("HTTP/1.1 200 OK\r\nA:1\r\nA:2\r\n\r\n", response.Serialize());
22 }
23
24 TEST(HttpServerResponseInfoTest, Body) {
25 HttpServerResponseInfo response;
26 ASSERT_EQ(std::string(), response.body());
27 response.SetBody("body", "type");
28 ASSERT_EQ("body", response.body());
29 ASSERT_EQ(
30 "HTTP/1.1 200 OK\r\nContent-Length:4\r\nContent-Type:type\r\n\r\nbody",
31 response.Serialize());
32 }
33
34 TEST(HttpServerResponseInfoTest, CreateFor404) {
35 HttpServerResponseInfo response = HttpServerResponseInfo::CreateFor404();
36 ASSERT_EQ(
37 "HTTP/1.1 404 Not Found\r\n"
38 "Content-Length:0\r\nContent-Type:text/html\r\n\r\n",
39 response.Serialize());
40 }
41
42 TEST(HttpServerResponseInfoTest, CreateFor500) {
43 HttpServerResponseInfo response =
44 HttpServerResponseInfo::CreateFor500("mess");
45 ASSERT_EQ(
46 "HTTP/1.1 500 Internal Server Error\r\n"
47 "Content-Length:4\r\nContent-Type:text/html\r\n\r\nmess",
48 response.Serialize());
49 }
50
51 } // namespace net
OLDNEW
« no previous file with comments | « net/server/http_server_response_info.cc ('k') | net/server/http_server_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698