summaryrefslogtreecommitdiffstats
path: root/net/base/net_log_unittest.h
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-24 15:55:51 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-24 15:55:51 +0000
commitee094b89dd380eed93bc0e6ce380d03a0b1b5329 (patch)
treed49719e986de616af7b59b95046be1613568a8f7 /net/base/net_log_unittest.h
parentbb872ba65a60c2ade48089f6f0bc538e0cc649ac (diff)
downloadchromium_src-ee094b89dd380eed93bc0e6ce380d03a0b1b5329.zip
chromium_src-ee094b89dd380eed93bc0e6ce380d03a0b1b5329.tar.gz
chromium_src-ee094b89dd380eed93bc0e6ce380d03a0b1b5329.tar.bz2
Adds HostResolveImpl Requests and Jobs to log.
Differences over the reverted version (http://codereview.chromium.org/3080034/show - reverted http://codereview.chromium.org/3137022/show ): * Jobs never log anything in their destructor, as the HostResolverImpl randomly outlives the NetLog, at least in some unit tests. * Removed the extra log entries for when a DNS lookup starts/completes. Instead, the job's event is ended in OnLookupComplete(). * Slight modification of the CanceledAsynchronousLookup unit test, as the Job is now closed before posting any events to the Request. For actual lookups, this behavior means the Job's duration more accurately reflects the time the DNS lookup takes itself. BUG=46844 TEST=Look at the net-internals screen. Review URL: http://codereview.chromium.org/3119027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_log_unittest.h')
-rw-r--r--net/base/net_log_unittest.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/net/base/net_log_unittest.h b/net/base/net_log_unittest.h
index 8db51e5..77a9cbd7 100644
--- a/net/base/net_log_unittest.h
+++ b/net/base/net_log_unittest.h
@@ -106,7 +106,7 @@ inline ::testing::AssertionResult LogContainsEntryWithType(
// Expect that the log contains an event, but don't care about where
-// as long as the index where it is found is greater than min_index.
+// as long as the first index where it is found is at least |min_index|.
// Returns the position where the event was found.
inline size_t ExpectLogContainsSomewhere(
const CapturingNetLog::EntryList& entries,
@@ -125,6 +125,25 @@ inline size_t ExpectLogContainsSomewhere(
return i;
}
+// Expect that the log contains an event, but don't care about where
+// as long as one index where it is found is at least |min_index|.
+// Returns the first such position where the event was found.
+inline size_t ExpectLogContainsSomewhereAfter(
+ const CapturingNetLog::EntryList& entries,
+ size_t min_index,
+ NetLog::EventType expected_event,
+ NetLog::EventPhase expected_phase) {
+ size_t i = min_index;
+ for (; i < entries.size(); ++i) {
+ const CapturingNetLog::Entry& entry = entries[i];
+ if (entry.type == expected_event &&
+ entry.phase == expected_phase)
+ break;
+ }
+ EXPECT_LT(i, entries.size());
+ return i;
+}
+
} // namespace net
#endif // NET_BASE_NET_LOG_UNITTEST_H_