| Index: net/base/load_log_unittest.h
|
| diff --git a/net/base/load_log_unittest.h b/net/base/load_log_unittest.h
|
| index da892a07a2a0b801ee28089e210946a0f4a87ea0..f67c8bc4e08c372a1fea7f0c87a2d8aac76f26bc 100644
|
| --- a/net/base/load_log_unittest.h
|
| +++ b/net/base/load_log_unittest.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef NET_BASE_LOAD_LOG_UNITTEST_H_
|
| #define NET_BASE_LOAD_LOG_UNITTEST_H_
|
|
|
| +#include <cstddef>
|
| #include "net/base/load_log.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -40,6 +41,29 @@ inline void ExpectLogContains(const LoadLog* log,
|
| EXPECT_EQ(expected_phase, log->events()[i].phase);
|
| }
|
|
|
| +inline ::testing::AssertionResult LogContains(
|
| + const LoadLog& log,
|
| + int i, // Negative indices are reverse indices.
|
| + LoadLog::EventType expected_event,
|
| + LoadLog::EventPhase expected_phase) {
|
| + // Negative indices are reverse indices.
|
| + size_t j = (i < 0) ? log.events().size() + i : i;
|
| + if (j >= log.events().size())
|
| + return ::testing::AssertionFailure() << j << " is out of bounds.";
|
| + if (expected_event != log.events()[j].type) {
|
| + return ::testing::AssertionFailure()
|
| + << "Actual event: " << LoadLog::EventTypeToString(log.events()[j].type)
|
| + << ". Expected event: " << LoadLog::EventTypeToString(expected_event)
|
| + << ".";
|
| + }
|
| + if (expected_phase != log.events()[j].phase) {
|
| + return ::testing::AssertionFailure()
|
| + << "Actual phase: " << log.events()[j].phase
|
| + << ". Expected phase: " << expected_phase << ".";
|
| + }
|
| + return ::testing::AssertionSuccess();
|
| +}
|
| +
|
| } // namespace net
|
|
|
| #endif // NET_BASE_LOAD_LOG_UNITTEST_H_
|
|
|