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

Issue 2030783003: Allow a callback to populate mock DNS responses. (Closed)

Created:
4 years, 6 months ago by Rob Percival
Modified:
4 years, 5 months ago
Reviewers:
mmenke
CC:
chromium-reviews, cbentzel+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Allow a callback to populate mock DNS responses. This improves the flexibility of the DNS mocking framework. It will be useful when testing the Certificate Transparency DNS client. BUG=612439

Patch Set 1 #

Total comments: 1

Patch Set 2 : Adds assignment operator to MockDnsClientRule #

Patch Set 3 : Rebase #

Patch Set 4 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+166 lines, -74 lines) Patch
M net/dns/dns_test_util.h View 1 2 chunks +36 lines, -10 lines 0 comments Download
M net/dns/dns_test_util.cc View 1 6 chunks +130 lines, -64 lines 0 comments Download

Messages

Total messages: 26 (8 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030783003/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2030783003/1
4 years, 6 months ago (2016-06-02 19:15:04 UTC) #2
Rob Percival
PTAL
4 years, 6 months ago (2016-06-02 19:18:04 UTC) #4
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: cast_shell_linux on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_linux/builds/170226)
4 years, 6 months ago (2016-06-02 19:33:24 UTC) #6
mmenke
https://codereview.chromium.org/2030783003/diff/1/net/dns/dns_test_util.h File net/dns/dns_test_util.h (right): https://codereview.chromium.org/2030783003/diff/1/net/dns/dns_test_util.h#newcode177 net/dns/dns_test_util.h:177: base::BigEndianWriter* answer_writer)>; Can you just use mock UDP sockets ...
4 years, 6 months ago (2016-06-02 19:46:05 UTC) #7
Rob Percival
On 2016/06/02 19:46:05, mmenke wrote: > https://codereview.chromium.org/2030783003/diff/1/net/dns/dns_test_util.h > File net/dns/dns_test_util.h (right): > > https://codereview.chromium.org/2030783003/diff/1/net/dns/dns_test_util.h#newcode177 > ...
4 years, 6 months ago (2016-06-02 21:20:04 UTC) #8
mmenke
On 2016/06/02 21:20:04, Rob Percival wrote: > On 2016/06/02 19:46:05, mmenke wrote: > > https://codereview.chromium.org/2030783003/diff/1/net/dns/dns_test_util.h ...
4 years, 6 months ago (2016-06-02 21:45:21 UTC) #9
Rob Percival
On 2016/06/02 21:45:21, mmenke wrote: > On 2016/06/02 21:20:04, Rob Percival wrote: > > On ...
4 years, 6 months ago (2016-06-02 22:34:43 UTC) #10
Rob Percival
On 2016/06/02 22:34:43, Rob Percival wrote: > On 2016/06/02 21:45:21, mmenke wrote: > > On ...
4 years, 6 months ago (2016-06-02 22:49:35 UTC) #11
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030783003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2030783003/20001
4 years, 6 months ago (2016-06-02 22:51:41 UTC) #13
mmenke
On 2016/06/02 22:49:35, Rob Percival wrote: > On 2016/06/02 22:34:43, Rob Percival wrote: > > ...
4 years, 6 months ago (2016-06-03 00:31:27 UTC) #14
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/240428)
4 years, 6 months ago (2016-06-03 00:36:52 UTC) #16
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030783003/40001
4 years, 6 months ago (2016-06-13 16:04:53 UTC) #18
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-13 17:04:33 UTC) #20
mmenke
This isn't blocked on me, right? Just want to make sure I'm not holding this ...
4 years, 6 months ago (2016-06-15 16:03:49 UTC) #21
chromium-reviews
No it's not, I'm still evaluating using mock sockets as an alternative. The only reason ...
4 years, 6 months ago (2016-06-15 16:20:53 UTC) #22
Rob Percival
On 2016/06/15 16:20:53, chromium-reviews wrote: > No it's not, I'm still evaluating using mock sockets ...
4 years, 5 months ago (2016-07-06 16:39:53 UTC) #24
Eran Messeri
To be clear, all I'm after is an easy way to test classes that use ...
4 years, 5 months ago (2016-07-08 11:53:16 UTC) #25
Rob Percival
4 years, 5 months ago (2016-07-15 16:30:21 UTC) #26
On 2016/07/08 11:53:16, Eran Messeri wrote:
> To be clear, all I'm after is an easy way to test classes that use the
> LogDnsClient that in turn uses net::DnsClient.
> It seems to me there is value in testing the LogDnsClient by using a real
> DnsClient and fake socket data (so we test the contract between the
LogDnsClient
> and the real DnsClient). However, it seems like there's less value in using a
> real DnsClient when the contract tested is between a user of the DnsClient and
a
> user of a user of the DnsClient.
> 
> There are ways to work around this, but having a way to specify clearly (i.e.
> setting expectations on a mock, compared to providing raw socket data) what
the
> LogDnsClient should receive makes testing usage of the LogDnsClient much
> simpler.

Here's another option I've put together - a reusable version of the test code
for LogDnsClient, powered by the mock sockets mmenke recommended:
https://codereview.chromium.org/2149973003/

Powered by Google App Engine
This is Rietveld 408576698