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

Issue 6516025: Remove GetInputStreamBufferSize() method from FilterContext. (Closed)

Created:
9 years, 10 months ago by adamk
Modified:
9 years, 7 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, jar (doing other things)
Visibility:
Public.

Description

Remove GetInputStreamBufferSize() method from FilterContext. This virtual method, implemented only by URLRequestJob and MockFilterContext, was only used for testing purposes. The kFilterBufSize constant now lives in filter.cc (the only place it was used), and for the few tests that needed to override the buffer size, I've added a test-only method in filter.h. The result is a smaller interface surface in URLRequestJob and simpler tests for most cases in gzip_filter_unittest.cc and sdch_filter_unittest.cc. I've done some further refactoring of the former to remove redundancy (most of Filter's complexity is exercised only in the SDCH test). Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=77315

Patch Set 1 #

Patch Set 2 : Hopefully fix build on non-Linux #

Patch Set 3 : Fixed signed/unsigned error #

Total comments: 8

Patch Set 4 : Removed #ifdef UNIT_TEST behavior, replace with friend tests #

Patch Set 5 : Fixed lint #

Total comments: 2

Patch Set 6 : New approach: FactoryForTests #

Total comments: 6

Patch Set 7 : Add some sanity checks #

Unified diffs Side-by-side diffs Delta from patch set Stats (+158 lines, -194 lines) Patch
M net/base/filter.h View 1 2 3 4 5 5 chunks +13 lines, -13 lines 0 comments Download
M net/base/filter.cc View 1 2 3 4 5 6 chunks +30 lines, -23 lines 0 comments Download
M net/base/filter_unittest.cc View 6 chunks +6 lines, -12 lines 0 comments Download
M net/base/gzip_filter.h View 1 2 3 4 5 2 chunks +4 lines, -2 lines 0 comments Download
M net/base/gzip_filter_unittest.cc View 1 2 3 4 5 6 11 chunks +48 lines, -61 lines 0 comments Download
M net/base/mock_filter_context.h View 2 chunks +1 line, -5 lines 0 comments Download
M net/base/mock_filter_context.cc View 2 chunks +2 lines, -5 lines 0 comments Download
M net/base/sdch_filter.h View 1 2 3 4 5 2 chunks +4 lines, -2 lines 0 comments Download
M net/base/sdch_filter_unittest.cc View 1 2 3 4 5 6 33 chunks +50 lines, -59 lines 0 comments Download
M net/url_request/url_request_job.h View 1 2 3 2 chunks +0 lines, -4 lines 0 comments Download
M net/url_request/url_request_job.cc View 1 2 3 2 chunks +0 lines, -8 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
adamk
9 years, 10 months ago (2011-02-14 20:50:41 UTC) #1
adamk
Adding jam as a possible alternate reviewer, as Will mentioned that he was also recently ...
9 years, 10 months ago (2011-02-15 01:36:37 UTC) #2
willchan no longer on Chromium
Dropped jam@. I think there may have been miscommunication over this, he's probably not appropriate ...
9 years, 10 months ago (2011-02-15 01:42:25 UTC) #3
willchan no longer on Chromium
This cleanup lgtm. But I think I'm going to defer to jar@ here.
9 years, 10 months ago (2011-02-15 01:52:02 UTC) #4
jar (doing other things)
Bottom line: I'd like to better understand why you're going in this direction(?), and where ...
9 years, 10 months ago (2011-02-15 06:48:53 UTC) #5
adamk
On Mon, Feb 14, 2011 at 10:48 PM, <jar@chromium.org> wrote: > Bottom line: I'd like ...
9 years, 10 months ago (2011-02-15 19:00:30 UTC) #6
adamk
Hi Jim, Can you take another look at this? Thanks, Adam On Tue, Feb 15, ...
9 years, 10 months ago (2011-02-22 23:32:47 UTC) #7
jar (doing other things)
http://codereview.chromium.org/6516025/diff/4001/net/base/filter.cc File net/base/filter.cc (right): http://codereview.chromium.org/6516025/diff/4001/net/base/filter.cc#newcode38 net/base/filter.cc:38: const int kFilterBufSize = 32 * 1024; As per ...
9 years, 10 months ago (2011-02-25 18:37:24 UTC) #8
adamk
http://codereview.chromium.org/6516025/diff/4001/net/base/filter.h File net/base/filter.h (right): http://codereview.chromium.org/6516025/diff/4001/net/base/filter.h#newcode180 net/base/filter.h:180: void ResetInputBufferForTest(int size) { On 2011/02/25 18:37:24, jar wrote: ...
9 years, 10 months ago (2011-02-25 20:48:13 UTC) #9
jar (doing other things)
http://codereview.chromium.org/6516025/diff/4001/net/base/filter.h File net/base/filter.h (right): http://codereview.chromium.org/6516025/diff/4001/net/base/filter.h#newcode180 net/base/filter.h:180: void ResetInputBufferForTest(int size) { Perhaps I chose the wrong ...
9 years, 10 months ago (2011-02-26 01:36:52 UTC) #10
adamk
One more shot, this time with an approach that very closely matches the previous code. ...
9 years, 9 months ago (2011-03-01 01:53:09 UTC) #11
jar (doing other things)
See small comments below. http://codereview.chromium.org/6516025/diff/17001/net/base/gzip_filter_unittest.cc File net/base/gzip_filter_unittest.cc (right): http://codereview.chromium.org/6516025/diff/17001/net/base/gzip_filter_unittest.cc#newcode261 net/base/gzip_filter_unittest.cc:261: deflate_encode_len_); With this code not ...
9 years, 9 months ago (2011-03-01 22:44:02 UTC) #12
adamk
Added some sanity checks as requested: buffers are big enough for memcpy(), and, when we ...
9 years, 9 months ago (2011-03-01 23:13:53 UTC) #13
adamk
Jim, do you have time to take another look at this? Thanks!
9 years, 9 months ago (2011-03-07 19:00:59 UTC) #14
jar (doing other things)
9 years, 9 months ago (2011-03-08 02:39:01 UTC) #15
LGTM

http://codereview.chromium.org/6516025/diff/17001/net/base/sdch_filter_unitte...
File net/base/sdch_filter_unittest.cc (left):

http://codereview.chromium.org/6516025/diff/17001/net/base/sdch_filter_unitte...
net/base/sdch_filter_unittest.cc:196: EXPECT_EQ(kInputBufferSize,
input_buffer_size);
You're correct.  This and the next few tests don't use the buffer... but it is
always nice to use a somewhat inductive set of tests.  Initially, you test basic
items, often as simple as whether a constructor sets args (or such as buffer
being as expected), and later you test complicated interactions, and don't need
to re-test basic elements.

It is equally fine to put the checks everywhere... I just noticed the change
looking at the delta (and I personally like the inductive buliding... but it is
your choice).

On 2011/03/01 23:13:54, Adam Klein wrote:
> On 2011/03/01 22:44:03, jar wrote:
> > This test appears to (among other things) test that the requested input
buffer
> > size is indeed obtained.  Please add that test somewhere (it works well
here),
> > but it is critical to know that we are indeed modulating the size as needed.
> 
> This test doesn't actually seem care how big the buffer is, as far as I can
> tell, only that it's big enough to hold the input data.  And so it no longer
> specifies a size and uses the default buffer size.
> 
> If what you want me to test is that Filter::FactoryForTests() is appropriately
> setting the buffer size, it seems to me that those tests belong with the tests
> that care about the buffer size, and I've added them in the four tests (three
in
> GZip, one in this file).
> 
> If I'm mistaken, and it's actually important that this test be run with a
> 30-byte buffer, please point that out.

Powered by Google App Engine
This is Rietveld 408576698