OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "chrome/common/ini_parser.h" | 8 #include "chrome/common/ini_parser.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 pair_i_(0) { | 32 pair_i_(0) { |
33 } | 33 } |
34 virtual ~TestINIParser() {} | 34 virtual ~TestINIParser() {} |
35 | 35 |
36 size_t pair_i() { | 36 size_t pair_i() { |
37 return pair_i_; | 37 return pair_i_; |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 virtual void HandleTriplet(const std::string& section, const std::string& key, | 41 virtual void HandleTriplet(const std::string& section, const std::string& key, |
42 const std::string& value) OVERRIDE { | 42 const std::string& value) override { |
43 EXPECT_EQ(expected_triplets_[pair_i_].section, section); | 43 EXPECT_EQ(expected_triplets_[pair_i_].section, section); |
44 EXPECT_EQ(expected_triplets_[pair_i_].key, key); | 44 EXPECT_EQ(expected_triplets_[pair_i_].key, key); |
45 EXPECT_EQ(expected_triplets_[pair_i_].value, value); | 45 EXPECT_EQ(expected_triplets_[pair_i_].value, value); |
46 ++pair_i_; | 46 ++pair_i_; |
47 } | 47 } |
48 | 48 |
49 std::vector<TestTriplet> expected_triplets_; | 49 std::vector<TestTriplet> expected_triplets_; |
50 size_t pair_i_; | 50 size_t pair_i_; |
51 }; | 51 }; |
52 | 52 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 EXPECT_TRUE(root.GetString("section1.key1", &value)); | 118 EXPECT_TRUE(root.GetString("section1.key1", &value)); |
119 EXPECT_EQ("value1", value); | 119 EXPECT_EQ("value1", value); |
120 EXPECT_FALSE(root.GetString("section1.key.2", &value)); | 120 EXPECT_FALSE(root.GetString("section1.key.2", &value)); |
121 EXPECT_TRUE(root.GetString("section1.key3", &value)); | 121 EXPECT_TRUE(root.GetString("section1.key3", &value)); |
122 EXPECT_EQ("va.lue3", value); | 122 EXPECT_EQ("va.lue3", value); |
123 EXPECT_FALSE(root.GetString("se.ction2.key.4", &value)); | 123 EXPECT_FALSE(root.GetString("se.ction2.key.4", &value)); |
124 EXPECT_FALSE(root.GetString("se.ction2.key5", &value)); | 124 EXPECT_FALSE(root.GetString("se.ction2.key5", &value)); |
125 } | 125 } |
126 | 126 |
127 } // namespace | 127 } // namespace |
OLD | NEW |