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

Side by Side Diff: net/log/test_net_log_util.h

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/log/test_net_log_entry.cc ('k') | net/log/test_net_log_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_LOG_TEST_NET_LOG_UTIL_H_ 5 #ifndef NET_LOG_TEST_NET_LOG_UTIL_H_
6 #define NET_LOG_TEST_NET_LOG_UTIL_H_ 6 #define NET_LOG_TEST_NET_LOG_UTIL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "net/log/net_log.h" 10 #include "net/log/net_log.h"
11 #include "net/log/net_log_event_type.h"
11 #include "net/log/test_net_log_entry.h" 12 #include "net/log/test_net_log_entry.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace net { 15 namespace net {
15 16
16 // Checks that the element of |entries| at |offset| has the provided values. 17 // Checks that the element of |entries| at |offset| has the provided values.
17 // A negative |offset| indicates a position relative to the end of |entries|. 18 // A negative |offset| indicates a position relative to the end of |entries|.
18 // Checks to make sure |offset| is within bounds, and fails gracefully if it 19 // Checks to make sure |offset| is within bounds, and fails gracefully if it
19 // isn't. 20 // isn't.
20 ::testing::AssertionResult LogContainsEvent( 21 ::testing::AssertionResult LogContainsEvent(
21 const TestNetLogEntry::List& entries, 22 const TestNetLogEntry::List& entries,
22 int offset, 23 int offset,
23 NetLog::EventType expected_event, 24 NetLogEventType expected_event,
24 NetLog::EventPhase expected_phase); 25 NetLogEventPhase expected_phase);
25 26
26 // Just like LogContainsEvent, but always checks for an EventPhase of 27 // Just like LogContainsEvent, but always checks for an EventPhase of
27 // PHASE_BEGIN. 28 // PHASE_BEGIN.
28 ::testing::AssertionResult LogContainsBeginEvent( 29 ::testing::AssertionResult LogContainsBeginEvent(
29 const TestNetLogEntry::List& entries, 30 const TestNetLogEntry::List& entries,
30 int offset, 31 int offset,
31 NetLog::EventType expected_event); 32 NetLogEventType expected_event);
32 33
33 // Just like LogContainsEvent, but always checks for an EventPhase of PHASE_END. 34 // Just like LogContainsEvent, but always checks for an EventPhase of PHASE_END.
34 ::testing::AssertionResult LogContainsEndEvent( 35 ::testing::AssertionResult LogContainsEndEvent(
35 const TestNetLogEntry::List& entries, 36 const TestNetLogEntry::List& entries,
36 int offset, 37 int offset,
37 NetLog::EventType expected_event); 38 NetLogEventType expected_event);
38 39
39 // Just like LogContainsEvent, but does not check phase. 40 // Just like LogContainsEvent, but does not check phase.
40 ::testing::AssertionResult LogContainsEntryWithType( 41 ::testing::AssertionResult LogContainsEntryWithType(
41 const TestNetLogEntry::List& entries, 42 const TestNetLogEntry::List& entries,
42 int offset, 43 int offset,
43 NetLog::EventType type); 44 NetLogEventType type);
44 45
45 // Check if the log contains an entry of the given type at |start_offset| or 46 // Check if the log contains an entry of the given type at |start_offset| or
46 // after. It is not a failure if there's an earlier matching entry. Negative 47 // after. It is not a failure if there's an earlier matching entry. Negative
47 // offsets are relative to the end of the array. 48 // offsets are relative to the end of the array.
48 ::testing::AssertionResult LogContainsEntryWithTypeAfter( 49 ::testing::AssertionResult LogContainsEntryWithTypeAfter(
49 const TestNetLogEntry::List& entries, 50 const TestNetLogEntry::List& entries,
50 int start_offset, 51 int start_offset,
51 NetLog::EventType type); 52 NetLogEventType type);
52 53
53 // Check if the first entry with the specified values is at |start_offset| or 54 // Check if the first entry with the specified values is at |start_offset| or
54 // after. It is a failure if there's an earlier matching entry. Negative 55 // after. It is a failure if there's an earlier matching entry. Negative
55 // offsets are relative to the end of the array. 56 // offsets are relative to the end of the array.
56 size_t ExpectLogContainsSomewhere(const TestNetLogEntry::List& entries, 57 size_t ExpectLogContainsSomewhere(const TestNetLogEntry::List& entries,
57 size_t min_offset, 58 size_t min_offset,
58 NetLog::EventType expected_event, 59 NetLogEventType expected_event,
59 NetLog::EventPhase expected_phase); 60 NetLogEventPhase expected_phase);
60 61
61 // Check if the log contains an entry with the given values at |start_offset| 62 // Check if the log contains an entry with the given values at |start_offset|
62 // or after. It is not a failure if there's an earlier matching entry. 63 // or after. It is not a failure if there's an earlier matching entry.
63 // Negative offsets are relative to the end of the array. 64 // Negative offsets are relative to the end of the array.
64 size_t ExpectLogContainsSomewhereAfter(const TestNetLogEntry::List& entries, 65 size_t ExpectLogContainsSomewhereAfter(const TestNetLogEntry::List& entries,
65 size_t start_offset, 66 size_t start_offset,
66 NetLog::EventType expected_event, 67 NetLogEventType expected_event,
67 NetLog::EventPhase expected_phase); 68 NetLogEventPhase expected_phase);
68 69
69 } // namespace net 70 } // namespace net
70 71
71 #endif // NET_LOG_TEST_NET_LOG_UTIL_H_ 72 #endif // NET_LOG_TEST_NET_LOG_UTIL_H_
OLDNEW
« no previous file with comments | « net/log/test_net_log_entry.cc ('k') | net/log/test_net_log_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698