[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / net / log / test_net_log_util.h
blobb0e4503e33ae700dae17dc4b631d472e8f95bcd5
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
3 // found in the LICENSE file.
5 #ifndef NET_LOG_TEST_NET_LOG_UTIL_H_
6 #define NET_LOG_TEST_NET_LOG_UTIL_H_
8 #include "net/log/net_log.h"
9 #include "net/log/test_net_log_entry.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace net {
14 // Checks that the element of |entries| at |offset| has the provided values.
15 // A negative |offset| indicates a position relative to the end of |entries|.
16 // Checks to make sure |offset| is within bounds, and fails gracefully if it
17 // isn't.
18 ::testing::AssertionResult LogContainsEvent(
19 const TestNetLogEntry::List& entries,
20 int offset,
21 NetLog::EventType expected_event,
22 NetLog::EventPhase expected_phase);
24 // Just like LogContainsEvent, but always checks for an EventPhase of
25 // PHASE_BEGIN.
26 ::testing::AssertionResult LogContainsBeginEvent(
27 const TestNetLogEntry::List& entries,
28 int offset,
29 NetLog::EventType expected_event);
31 // Just like LogContainsEvent, but always checks for an EventPhase of PHASE_END.
32 ::testing::AssertionResult LogContainsEndEvent(
33 const TestNetLogEntry::List& entries,
34 int offset,
35 NetLog::EventType expected_event);
37 // Just like LogContainsEvent, but does not check phase.
38 ::testing::AssertionResult LogContainsEntryWithType(
39 const TestNetLogEntry::List& entries,
40 int offset,
41 NetLog::EventType type);
43 // Check if the log contains an entry of the given type at |start_offset| or
44 // after. It is not a failure if there's an earlier matching entry. Negative
45 // offsets are relative to the end of the array.
46 ::testing::AssertionResult LogContainsEntryWithTypeAfter(
47 const TestNetLogEntry::List& entries,
48 int start_offset,
49 NetLog::EventType type);
51 // Check if the first entry with the specified values is at |start_offset| or
52 // after. It is a failure if there's an earlier matching entry. Negative
53 // offsets are relative to the end of the array.
54 size_t ExpectLogContainsSomewhere(const TestNetLogEntry::List& entries,
55 size_t min_offset,
56 NetLog::EventType expected_event,
57 NetLog::EventPhase expected_phase);
59 // Check if the log contains an entry with the given values at |start_offset|
60 // or after. It is not a failure if there's an earlier matching entry.
61 // Negative offsets are relative to the end of the array.
62 size_t ExpectLogContainsSomewhereAfter(const TestNetLogEntry::List& entries,
63 size_t start_offset,
64 NetLog::EventType expected_event,
65 NetLog::EventPhase expected_phase);
67 } // namespace net
69 #endif // NET_LOG_TEST_NET_LOG_UTIL_H_