Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/WebRequest.cpp

Issue 29377775: Issue 4916 - Request compression in CURL WebRequest. (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Issue 4916 - Request compression in CURL WebRequest. (updated test) Created March 2, 2017, 1:45 p.m.
Right Patch Set: Updated patch to fix test. Created March 2, 2017, 3:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/DefaultWebRequestCurl.cpp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 do 83 do
84 { 84 {
85 AdblockPlus::Sleep(200); 85 AdblockPlus::Sleep(200);
86 } while (jsEngine->Evaluate("this.foo")->IsUndefined()); 86 } while (jsEngine->Evaluate("this.foo")->IsUndefined());
87 ASSERT_EQ("text/plain", jsEngine->Evaluate("foo.responseHeaders['content-type' ].substr(0, 10)")->AsString()); 87 ASSERT_EQ("text/plain", jsEngine->Evaluate("foo.responseHeaders['content-type' ].substr(0, 10)")->AsString());
88 ASSERT_EQ(AdblockPlus::WebRequest::NS_OK, jsEngine->Evaluate("foo.status")->As Int()); 88 ASSERT_EQ(AdblockPlus::WebRequest::NS_OK, jsEngine->Evaluate("foo.status")->As Int());
89 ASSERT_EQ(200, jsEngine->Evaluate("foo.responseStatus")->AsInt()); 89 ASSERT_EQ(200, jsEngine->Evaluate("foo.responseStatus")->AsInt());
90 ASSERT_EQ("[Adblock Plus ", jsEngine->Evaluate("foo.responseText.substr(0, 14) ")->AsString()); 90 ASSERT_EQ("[Adblock Plus ", jsEngine->Evaluate("foo.responseText.substr(0, 14) ")->AsString());
91 ASSERT_EQ("text/plain", jsEngine->Evaluate("foo.responseHeaders['content-type' ].substr(0, 10)")->AsString()); 91 ASSERT_EQ("text/plain", jsEngine->Evaluate("foo.responseHeaders['content-type' ].substr(0, 10)")->AsString());
92 #if defined(HAVE_CURL) 92 #if defined(HAVE_CURL)
93 ASSERT_EQ("gzip", jsEngine->Evaluate("foo.responseHeaders['content-encoding']. substr(0, 5)")->AsString()); 93 ASSERT_EQ("gzip", jsEngine->Evaluate("foo.responseHeaders['content-encoding']. substr(0, 4)")->AsString());
Felix Dahlke 2017/03/02 14:33:39 Nit: Given how "gzip" is a four character string,
hub 2017/03/02 15:36:00 Acknowledged.
sergei 2017/03/02 21:05:26 Sorry, my bad, off by one error.
94 #endif 94 #endif
95 ASSERT_TRUE(jsEngine->Evaluate("foo.responseHeaders['location']")->IsUndefined ()); 95 ASSERT_TRUE(jsEngine->Evaluate("foo.responseHeaders['location']")->IsUndefined ());
96 } 96 }
97 97
98 TEST_F(DefaultWebRequestTest, XMLHttpRequest) 98 TEST_F(DefaultWebRequestTest, XMLHttpRequest)
99 { 99 {
100 AdblockPlus::FilterEngine filterEngine(jsEngine); 100 AdblockPlus::FilterEngine filterEngine(jsEngine);
101 101
102 jsEngine->Evaluate("\ 102 jsEngine->Evaluate("\
103 var result;\ 103 var result;\
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 { 150 {
151 AdblockPlus::Sleep(200); 151 AdblockPlus::Sleep(200);
152 } while (jsEngine->Evaluate("result")->IsUndefined()); 152 } while (jsEngine->Evaluate("result")->IsUndefined());
153 ASSERT_EQ(AdblockPlus::WebRequest::NS_ERROR_FAILURE, jsEngine->Evaluate("reque st.channel.status")->AsInt()); 153 ASSERT_EQ(AdblockPlus::WebRequest::NS_ERROR_FAILURE, jsEngine->Evaluate("reque st.channel.status")->AsInt());
154 ASSERT_EQ(0, jsEngine->Evaluate("request.status")->AsInt()); 154 ASSERT_EQ(0, jsEngine->Evaluate("request.status")->AsInt());
155 ASSERT_EQ("error", jsEngine->Evaluate("result")->AsString()); 155 ASSERT_EQ("error", jsEngine->Evaluate("result")->AsString());
156 ASSERT_TRUE(jsEngine->Evaluate("request.getResponseHeader('Content-Type')")->I sNull()); 156 ASSERT_TRUE(jsEngine->Evaluate("request.getResponseHeader('Content-Type')")->I sNull());
157 } 157 }
158 158
159 #endif 159 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld