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

Issue 2074093002: Add a unittest for image_data_fetcher (Closed)

Created:
4 years, 6 months ago by markusheintz_
Modified:
4 years, 6 months ago
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add a unittest for the ImageDataFetcher class BUG=609127 Committed: https://crrev.com/c2fbb0f083499da42b6c4793108f689995cc4a5b Cr-Commit-Position: refs/heads/master@{#401236}

Patch Set 1 #

Patch Set 2 : Update gyp files #

Patch Set 3 : Fix unit_test deps #

Patch Set 4 : Fix unit_test deps #

Patch Set 5 : Adding comments and fix minor nits #

Patch Set 6 : Sync to tot #

Patch Set 7 : Really sync to tot #

Total comments: 29

Patch Set 8 : Address comments bauerb@ #

Total comments: 17

Patch Set 9 : Address comments treib@ #

Total comments: 12

Patch Set 10 : Use MOCK_METHODS #

Patch Set 11 : Address comments bauerb@, treib@ #

Patch Set 12 : Use only a single callback object in the FetchImageData_MultipleRequests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+141 lines, -2 lines) Patch
M components/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M components/components_tests.gyp View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M components/image_fetcher/BUILD.gn View 1 2 3 4 5 6 7 8 9 1 chunk +14 lines, -0 lines 0 comments Download
M components/image_fetcher/image_data_fetcher.h View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -0 lines 0 comments Download
M components/image_fetcher/image_data_fetcher.cc View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -2 lines 0 comments Download
A components/image_fetcher/image_data_fetcher_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +111 lines, -0 lines 0 comments Download

Messages

Total messages: 36 (7 generated)
markusheintz_
Fix unit_test deps
4 years, 6 months ago (2016-06-20 12:11:42 UTC) #1
markusheintz_
Fix unit_test deps
4 years, 6 months ago (2016-06-20 12:12:20 UTC) #2
markusheintz_
Adding comments and fix minor nits
4 years, 6 months ago (2016-06-20 12:39:01 UTC) #3
markusheintz_
Sync to tot
4 years, 6 months ago (2016-06-20 12:45:01 UTC) #5
markusheintz_
Really sync to tot
4 years, 6 months ago (2016-06-20 12:53:36 UTC) #6
markusheintz_
On 2016/06/20 12:53:36, markusheintz_ wrote: > Really sync to tot Hey Marc and Bernhard PTAL
4 years, 6 months ago (2016-06-20 12:58:08 UTC) #8
Bernhard Bauer
https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher.h File components/image_fetcher/image_data_fetcher.h (right): https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher.h#newcode52 components/image_fetcher/image_data_fetcher.h:52: // The next id to use for a newly ...
4 years, 6 months ago (2016-06-20 13:36:16 UTC) #9
markusheintz_
Address comments bauerb@
4 years, 6 months ago (2016-06-20 14:24:49 UTC) #10
markusheintz_
https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher.h File components/image_fetcher/image_data_fetcher.h (right): https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher.h#newcode52 components/image_fetcher/image_data_fetcher.h:52: // The next id to use for a newly ...
4 years, 6 months ago (2016-06-20 14:30:17 UTC) #11
Marc Treib
https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher.h File components/image_fetcher/image_data_fetcher.h (right): https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher.h#newcode57 components/image_fetcher/image_data_fetcher.h:57: int url_fetcher_id_; next_url_fetcher_id_ ? https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher_unittest.cc File components/image_fetcher/image_data_fetcher_unittest.cc (right): https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher_unittest.cc#newcode71 ...
4 years, 6 months ago (2016-06-20 14:47:29 UTC) #12
markusheintz_
Address comments treib@
4 years, 6 months ago (2016-06-20 15:06:38 UTC) #13
markusheintz_
https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher.h File components/image_fetcher/image_data_fetcher.h (right): https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher.h#newcode57 components/image_fetcher/image_data_fetcher.h:57: int url_fetcher_id_; On 2016/06/20 14:47:29, Marc Treib wrote: > ...
4 years, 6 months ago (2016-06-20 15:06:53 UTC) #14
Marc Treib
LGTM, thanks for adding these tests! I'll leave it up to you whether to change ...
4 years, 6 months ago (2016-06-20 15:21:42 UTC) #15
Bernhard Bauer
https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher_unittest.cc File components/image_fetcher/image_data_fetcher_unittest.cc (right): https://codereview.chromium.org/2074093002/diff/120001/components/image_fetcher/image_data_fetcher_unittest.cc#newcode86 components/image_fetcher/image_data_fetcher_unittest.cc:86: // Call the URLFetcher delegate to continue the test. ...
4 years, 6 months ago (2016-06-20 17:28:38 UTC) #16
markusheintz_
Use MOCK_METHODS
4 years, 6 months ago (2016-06-21 15:43:52 UTC) #17
markusheintz_
Address comments bauerb@, treib@
4 years, 6 months ago (2016-06-21 15:55:15 UTC) #18
markusheintz_
https://codereview.chromium.org/2074093002/diff/140001/components/image_fetcher/image_data_fetcher_unittest.cc File components/image_fetcher/image_data_fetcher_unittest.cc (right): https://codereview.chromium.org/2074093002/diff/140001/components/image_fetcher/image_data_fetcher_unittest.cc#newcode28 components/image_fetcher/image_data_fetcher_unittest.cc:28: : message_loop_(), On 2016/06/20 17:28:38, Bernhard Bauer wrote: > ...
4 years, 6 months ago (2016-06-21 15:56:08 UTC) #19
Bernhard Bauer
lgtm https://codereview.chromium.org/2074093002/diff/140001/components/image_fetcher/image_data_fetcher_unittest.cc File components/image_fetcher/image_data_fetcher_unittest.cc (right): https://codereview.chromium.org/2074093002/diff/140001/components/image_fetcher/image_data_fetcher_unittest.cc#newcode36 components/image_fetcher/image_data_fetcher_unittest.cc:36: void OnImageDataFetched(const std::string& image_data) { On 2016/06/21 15:56:08, ...
4 years, 6 months ago (2016-06-21 16:24:19 UTC) #20
markusheintz_
On 2016/06/21 16:24:19, Bernhard Bauer wrote: > lgtm > > https://codereview.chromium.org/2074093002/diff/140001/components/image_fetcher/image_data_fetcher_unittest.cc > File components/image_fetcher/image_data_fetcher_unittest.cc (right): ...
4 years, 6 months ago (2016-06-21 20:00:51 UTC) #21
markusheintz_
Use only a single callback object in the FetchImageData_MultipleRequests
4 years, 6 months ago (2016-06-21 20:09:35 UTC) #22
markusheintz_
On 2016/06/21 20:09:35, markusheintz_ wrote: > Use only a single callback object in the FetchImageData_MultipleRequests ...
4 years, 6 months ago (2016-06-21 20:11:16 UTC) #24
Bernhard Bauer
On Tue, Jun 21, 2016, 21:00 <markusheintz@chromium.org> wrote: > On 2016/06/21 16:24:19, Bernhard Bauer wrote: ...
4 years, 6 months ago (2016-06-21 20:51:15 UTC) #25
markusheintz_
On 2016/06/21 20:51:15, Bernhard Bauer wrote: > On Tue, Jun 21, 2016, 21:00 <mailto:markusheintz@chromium.org> wrote: ...
4 years, 6 months ago (2016-06-21 20:56:42 UTC) #26
Bernhard Bauer
On 2016/06/21 20:56:42, markusheintz_ wrote: > On 2016/06/21 20:51:15, Bernhard Bauer wrote: > > On ...
4 years, 6 months ago (2016-06-21 21:37:22 UTC) #27
blundell
lgtm
4 years, 6 months ago (2016-06-22 05:40:09 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2074093002/220001
4 years, 6 months ago (2016-06-22 09:02:57 UTC) #31
commit-bot: I haz the power
Committed patchset #12 (id:220001)
4 years, 6 months ago (2016-06-22 09:07:50 UTC) #33
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/c2fbb0f083499da42b6c4793108f689995cc4a5b Cr-Commit-Position: refs/heads/master@{#401236}
4 years, 6 months ago (2016-06-22 09:09:48 UTC) #35
markusheintz_
4 years, 6 months ago (2016-06-22 13:08:41 UTC) #36
Message was sent while issue was closed.
On 2016/06/21 21:37:22, Bernhard Bauer wrote:
> On 2016/06/21 20:56:42, markusheintz_ wrote:
> > On 2016/06/21 20:51:15, Bernhard Bauer wrote:
> > > On Tue, Jun 21, 2016, 21:00 <mailto:markusheintz@chromium.org> wrote:
> > > 
> > > > On 2016/06/21 16:24:19, Bernhard Bauer wrote:
> > > > > lgtm
> > > > >
> > > > >
> > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/2074093002/diff/140001/components/image_fetch...
> > > > > File components/image_fetcher/image_data_fetcher_unittest.cc (right):
> > > > >
> > > > >
> > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/2074093002/diff/140001/components/image_fetch...
> > > > > components/image_fetcher/image_data_fetcher_unittest.cc:36: void
> > > > > OnImageDataFetched(const std::string& image_data) {
> > > > > On 2016/06/21 15:56:08, markusheintz_ wrote:
> > > > > > On 2016/06/20 17:28:38, Bernhard Bauer wrote:
> > > > > > > These callbacks could be protected.
> > > > > >
> > > > > > Using MOCK_METHODS now
> > > > >
> > > > > They still could be protected :-D
> > > >
> > > > Sorry they can't since gmock demands that they are public.
> > > >
> > > 
> > > Hm, in the GMock documentation (
> > >
> >
>
https://github.com/google/googlemock/blob/master/googlemock/docs/v1_6/CookBoo...)
> > > I only find this as rationale: "This allows ON_CALL and EXPECT_CALL to
> > > reference the mock function from outside of the mock class.". But we are
in
> > > fact in a subclass when we're setting up the expectations, so protected
> > > should be sufficient. Not a big deal though :)
> > 
> > The code does not compile if I make the methods protected. I don't have the
> link
> > to the source at my hand, but I was told that when expectations are set, the
> > frameworks (which is in a different package) calls the mock method. 
> 
> I see. Thanks for checking!

For the sake of completeness here is the link to the doc I mentioned:
https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#...

Powered by Google App Engine
This is Rietveld 408576698