Index: chrome/browser/google_apis/test_server/http_response_unittest.cc |
diff --git a/chrome/browser/google_apis/test_server/http_response_unittest.cc b/chrome/browser/google_apis/test_server/http_response_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..16f41f82b36f43383b90e0b98db5b0ba4716f5c0 |
--- /dev/null |
+++ b/chrome/browser/google_apis/test_server/http_response_unittest.cc |
@@ -0,0 +1,33 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/google_apis/test_server/http_response.h" |
+ |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace drive { |
+namespace test_server { |
+ |
+TEST(HttpResponseTest, GenerateResponse) { |
+ HttpResponse response; |
+ response.code = SUCCESS; |
+ response.content = "Sample content - Hello world!"; |
+ response.content_type = "text/plain"; |
+ response.custom_headers["Simple-Header"] = "Simple value."; |
+ std::string response_string = response.ToResponseString(); |
+ |
+ std::string kExpectedResponseString = |
+ "HTTP/1.1 200 OK\r\n" |
+ "Connection: closed\r\n" |
+ "Content-Length: 29\r\n" |
+ "Content-Type: text/plain\r\n" |
+ "Simple-Header: Simple value.\r\n\r\n" |
+ "Sample content - Hello world!"; |
+ |
+ EXPECT_EQ(kExpectedResponseString, |
+ response_string); |
+} |
+ |
+} // namespace test_server |
+} // namespace drive |