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

Side by Side Diff: webkit/glue/webplugin_impl_unittest.cc

Issue 181014: Eliminate remaining WebCore dependencies from webplugin_impl.cc... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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"
6
7 // Avoid collisions with the LOG macro
8 #include <wtf/Assertions.h>
9 #undef LOG
10
11 #include "base/string_util.h" 5 #include "base/string_util.h"
12 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "webkit/api/public/WebCString.h"
13 #include "webkit/api/public/WebString.h" 8 #include "webkit/api/public/WebString.h"
14 #include "webkit/api/public/WebURLRequest.h" 9 #include "webkit/api/public/WebURLRequest.h"
15 #include "webkit/glue/glue_util.h"
16 #include "webkit/glue/webplugin_impl.h" 10 #include "webkit/glue/webplugin_impl.h"
17 11
18 using WebKit::WebHTTPBody; 12 using WebKit::WebHTTPBody;
19 using WebKit::WebString; 13 using WebKit::WebString;
20 using WebKit::WebURLRequest; 14 using WebKit::WebURLRequest;
15 using webkit_glue::WebPluginImpl;
21 16
22 namespace { 17 namespace {
23 18
24 class WebPluginImplTest : public testing::Test { 19 class WebPluginImplTest : public testing::Test {
25 }; 20 };
26 21
27 } 22 }
28 23
29 // These exist only to support the gTest assertion macros, and
30 // shouldn't be used in normal program code.
31 std::ostream& operator<<(std::ostream& out, const WebCore::String& str)
32 {
33 return out << str.latin1().data();
34 }
35
36 static std::string GetHeader(const WebURLRequest& request, const char* name) { 24 static std::string GetHeader(const WebURLRequest& request, const char* name) {
37 std::string result; 25 std::string result;
38 TrimWhitespace( 26 TrimWhitespace(
39 webkit_glue::WebStringToStdString( 27 request.httpHeaderField(WebString::fromUTF8(name)).utf8(),
40 request.httpHeaderField(WebString::fromUTF8(name))),
41 TRIM_ALL, 28 TRIM_ALL,
42 &result); 29 &result);
43 return result; 30 return result;
44 } 31 }
45 32
46 static std::string GetBodyText(const WebURLRequest& request) { 33 static std::string GetBodyText(const WebURLRequest& request) {
47 const WebHTTPBody& body = request.httpBody(); 34 const WebHTTPBody& body = request.httpBody();
48 if (body.isNull()) 35 if (body.isNull())
49 return std::string(); 36 return std::string();
50 37
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 EXPECT_EQ(0U, GetHeader(request, "bar").length()); 223 EXPECT_EQ(0U, GetHeader(request, "bar").length());
237 EXPECT_EQ(0U, GetHeader(request, "Content-length").length()); 224 EXPECT_EQ(0U, GetHeader(request, "Content-length").length());
238 225
239 std::string body = GetBodyText(request); 226 std::string body = GetBodyText(request);
240 227
241 EXPECT_EQ(0xF0, (unsigned char)body[0]); 228 EXPECT_EQ(0xF0, (unsigned char)body[0]);
242 EXPECT_EQ(0xFF, (unsigned char)body[1]); 229 EXPECT_EQ(0xFF, (unsigned char)body[1]);
243 EXPECT_EQ(0xFF, (unsigned char)body[2]); 230 EXPECT_EQ(0xFF, (unsigned char)body[2]);
244 EXPECT_EQ(0xFF, (unsigned char)body[3]); 231 EXPECT_EQ(0xFF, (unsigned char)body[3]);
245 } 232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698