OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/history/query_parser.h" | 8 #include "chrome/browser/history/query_parser.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 class QueryParserTest : public testing::Test { | 11 class QueryParserTest : public testing::Test { |
12 public: | 12 public: |
13 struct TestData { | 13 struct TestData { |
14 const char* input; | 14 const char* input; |
15 const int expected_word_count; | 15 const int expected_word_count; |
16 }; | 16 }; |
17 | 17 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 QueryParser parser; | 156 QueryParser parser; |
157 parser.ParseQueryWords(UTF8ToUTF16(data[i].text), &results); | 157 parser.ParseQueryWords(UTF8ToUTF16(data[i].text), &results); |
158 ASSERT_EQ(data[i].word_count, results.size()); | 158 ASSERT_EQ(data[i].word_count, results.size()); |
159 EXPECT_EQ(data[i].w1, UTF16ToUTF8(results[0])); | 159 EXPECT_EQ(data[i].w1, UTF16ToUTF8(results[0])); |
160 if (results.size() == 2) | 160 if (results.size() == 2) |
161 EXPECT_EQ(data[i].w2, UTF16ToUTF8(results[1])); | 161 EXPECT_EQ(data[i].w2, UTF16ToUTF8(results[1])); |
162 if (results.size() == 3) | 162 if (results.size() == 3) |
163 EXPECT_EQ(data[i].w3, UTF16ToUTF8(results[2])); | 163 EXPECT_EQ(data[i].w3, UTF16ToUTF8(results[2])); |
164 } | 164 } |
165 } | 165 } |
OLD | NEW |