| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 // Avoid collisions with the LOG macro | 7 // Avoid collisions with the LOG macro |
| 8 #include <wtf/Assertions.h> | 8 #include <wtf/Assertions.h> |
| 9 #undef LOG | 9 #undef LOG |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // These exist only to support the gTest assertion macros, and | 29 // These exist only to support the gTest assertion macros, and |
| 30 // shouldn't be used in normal program code. | 30 // shouldn't be used in normal program code. |
| 31 std::ostream& operator<<(std::ostream& out, const WebCore::String& str) | 31 std::ostream& operator<<(std::ostream& out, const WebCore::String& str) |
| 32 { | 32 { |
| 33 return out << str.latin1().data(); | 33 return out << str.latin1().data(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 static std::string GetHeader(const WebURLRequest& request, const char* name) { | 36 static std::string GetHeader(const WebURLRequest& request, const char* name) { |
| 37 std::string result; | 37 std::string result; |
| 38 TrimWhitespace( | 38 TrimWhitespaceASCII( |
| 39 webkit_glue::WebStringToStdString( | 39 webkit_glue::WebStringToStdString( |
| 40 request.httpHeaderField(WebString::fromUTF8(name))), | 40 request.httpHeaderField(WebString::fromUTF8(name))), |
| 41 TRIM_ALL, | 41 TRIM_ALL, |
| 42 &result); | 42 &result); |
| 43 return result; | 43 return result; |
| 44 } | 44 } |
| 45 | 45 |
| 46 static std::string GetBodyText(const WebURLRequest& request) { | 46 static std::string GetBodyText(const WebURLRequest& request) { |
| 47 const WebHTTPBody& body = request.httpBody(); | 47 const WebHTTPBody& body = request.httpBody(); |
| 48 if (body.isNull()) | 48 if (body.isNull()) |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 EXPECT_EQ(0U, GetHeader(request, "bar").length()); | 236 EXPECT_EQ(0U, GetHeader(request, "bar").length()); |
| 237 EXPECT_EQ(0U, GetHeader(request, "Content-length").length()); | 237 EXPECT_EQ(0U, GetHeader(request, "Content-length").length()); |
| 238 | 238 |
| 239 std::string body = GetBodyText(request); | 239 std::string body = GetBodyText(request); |
| 240 | 240 |
| 241 EXPECT_EQ(0xF0, (unsigned char)body[0]); | 241 EXPECT_EQ(0xF0, (unsigned char)body[0]); |
| 242 EXPECT_EQ(0xFF, (unsigned char)body[1]); | 242 EXPECT_EQ(0xFF, (unsigned char)body[1]); |
| 243 EXPECT_EQ(0xFF, (unsigned char)body[2]); | 243 EXPECT_EQ(0xFF, (unsigned char)body[2]); |
| 244 EXPECT_EQ(0xFF, (unsigned char)body[3]); | 244 EXPECT_EQ(0xFF, (unsigned char)body[3]); |
| 245 } | 245 } |
| OLD | NEW |