| 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
|
|
|