OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/test/expectations/parser.h" | 5 #include "base/test/expectations/parser.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 using test_expectations::Parser; | 13 using test_expectations::Parser; |
14 | 14 |
15 class TestExpectationParserTest : public testing::Test, | 15 class TestExpectationParserTest : public testing::Test, |
16 public Parser::Delegate { | 16 public Parser::Delegate { |
17 public: | 17 public: |
18 virtual void EmitExpectation( | 18 void EmitExpectation( |
19 const test_expectations::Expectation& expectation) OVERRIDE { | 19 const test_expectations::Expectation& expectation) override { |
20 expectations_.push_back(expectation); | 20 expectations_.push_back(expectation); |
21 } | 21 } |
22 | 22 |
23 virtual void OnSyntaxError(const std::string& message) OVERRIDE { | 23 void OnSyntaxError(const std::string& message) override { |
24 syntax_error_ = message; | 24 syntax_error_ = message; |
25 } | 25 } |
26 | 26 |
27 virtual void OnDataError(const std::string& error) OVERRIDE { | 27 void OnDataError(const std::string& error) override { |
28 data_errors_.push_back(error); | 28 data_errors_.push_back(error); |
29 } | 29 } |
30 | 30 |
31 protected: | 31 protected: |
32 std::vector<test_expectations::Expectation> expectations_; | 32 std::vector<test_expectations::Expectation> expectations_; |
33 std::string syntax_error_; | 33 std::string syntax_error_; |
34 std::vector<std::string> data_errors_; | 34 std::vector<std::string> data_errors_; |
35 }; | 35 }; |
36 | 36 |
37 TEST_F(TestExpectationParserTest, Basic) { | 37 TEST_F(TestExpectationParserTest, Basic) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 ". [Mac-TurningIntoiOS] BadModifierVariant.BadResult = Foobar", | 200 ". [Mac-TurningIntoiOS] BadModifierVariant.BadResult = Foobar", |
201 "1234 [ Debug Release OS/2 ] MultipleConfigs.BadModifier = Pass", | 201 "1234 [ Debug Release OS/2 ] MultipleConfigs.BadModifier = Pass", |
202 }; | 202 }; |
203 | 203 |
204 for (size_t i = 0; i < arraysize(kTwoErrors); ++i) { | 204 for (size_t i = 0; i < arraysize(kTwoErrors); ++i) { |
205 Parser(this, kTwoErrors[i]).Parse(); | 205 Parser(this, kTwoErrors[i]).Parse(); |
206 EXPECT_EQ(2u, data_errors_.size()) << kTwoErrors[i]; | 206 EXPECT_EQ(2u, data_errors_.size()) << kTwoErrors[i]; |
207 data_errors_.clear(); | 207 data_errors_.clear(); |
208 } | 208 } |
209 } | 209 } |
OLD | NEW |