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

Unified Diff: headless/public/util/error_reporter_unittest.cc

Issue 2474433007: headless: Fix ErrorReporter unit tests (Closed)
Patch Set: Created 4 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 | « headless/public/domains/types_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/public/util/error_reporter_unittest.cc
diff --git a/headless/public/util/error_reporter_unittest.cc b/headless/public/util/error_reporter_unittest.cc
index f23ced9ef2993bfd2a858f72ed2be270ae21bf7a..5752c86b570640aace384ab5ae39dbac1ca395fe 100644
--- a/headless/public/util/error_reporter_unittest.cc
+++ b/headless/public/util/error_reporter_unittest.cc
@@ -9,18 +9,22 @@ namespace headless {
TEST(ErrorReporterTest, NoErrors) {
ErrorReporter reporter;
+#if DCHECK_IS_ON()
EXPECT_FALSE(reporter.HasErrors());
EXPECT_TRUE(reporter.errors().empty());
+#endif // DCHECK_IS_ON()
}
TEST(ErrorReporterTest, TopLevelErrors) {
ErrorReporter reporter;
reporter.AddError("instructions unclear");
reporter.AddError("head stuck in std::unordered_map");
+#if DCHECK_IS_ON()
EXPECT_TRUE(reporter.HasErrors());
EXPECT_EQ(2u, reporter.errors().size());
EXPECT_EQ("instructions unclear", reporter.errors()[0]);
EXPECT_EQ("head stuck in std::unordered_map", reporter.errors()[1]);
+#endif // DCHECK_IS_ON()
}
TEST(ErrorReporterTest, UnnamedContext) {
@@ -28,9 +32,11 @@ TEST(ErrorReporterTest, UnnamedContext) {
reporter.Push();
reporter.AddError("lp0 is on fire");
reporter.Pop();
+#if DCHECK_IS_ON()
EXPECT_TRUE(reporter.HasErrors());
EXPECT_EQ(1u, reporter.errors().size());
EXPECT_EQ("lp0 is on fire", reporter.errors()[0]);
+#endif // DCHECK_IS_ON()
}
TEST(ErrorReporterTest, NestedContexts) {
@@ -43,10 +49,12 @@ TEST(ErrorReporterTest, NestedContexts) {
reporter.Pop();
reporter.AddError("uh oh");
reporter.Pop();
+#if DCHECK_IS_ON()
EXPECT_TRUE(reporter.HasErrors());
EXPECT_EQ(2u, reporter.errors().size());
EXPECT_EQ("ship.front: fell off", reporter.errors()[0]);
EXPECT_EQ("ship: uh oh", reporter.errors()[1]);
+#endif // DCHECK_IS_ON()
}
} // namespace headless
« no previous file with comments | « headless/public/domains/types_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698