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

Unified Diff: net/base/load_log_unittest.h

Issue 344026: Add LoadLog to ClientSocket::Connect(). (Closed)
Patch Set: Minor build fixups and fixed mac bug. Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/load_log_event_type_list.h ('k') | net/flip/flip_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « net/base/load_log_event_type_list.h ('k') | net/flip/flip_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698