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 "chrome/browser/autocomplete/answers_cache.h" | 5 #include "components/omnibox/answers_cache.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 TEST(AnswersCacheTest, CacheStartsEmpty) { | 10 TEST(AnswersCacheTest, CacheStartsEmpty) { |
11 AnswersCache cache(1); | 11 AnswersCache cache(1); |
12 EXPECT_TRUE(cache.empty()); | 12 EXPECT_TRUE(cache.empty()); |
13 } | 13 } |
14 | 14 |
15 TEST(AnswersCacheTest, UpdatePopulatesCache) { | 15 TEST(AnswersCacheTest, UpdatePopulatesCache) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Test that duplicate entries update recency. | 104 // Test that duplicate entries update recency. |
105 cache.UpdateRecentAnswers(query_weather_lb, query_type); | 105 cache.UpdateRecentAnswers(query_weather_lb, query_type); |
106 EXPECT_EQ(query_weather_lb, | 106 EXPECT_EQ(query_weather_lb, |
107 cache.GetTopAnswerEntry(query_weather_l).full_query_text); | 107 cache.GetTopAnswerEntry(query_weather_l).full_query_text); |
108 | 108 |
109 // Test duplicate do not evict other entries. LV should still be in cache. | 109 // Test duplicate do not evict other entries. LV should still be in cache. |
110 cache.UpdateRecentAnswers(query_weather_lb, query_type); | 110 cache.UpdateRecentAnswers(query_weather_lb, query_type); |
111 EXPECT_FALSE( | 111 EXPECT_FALSE( |
112 cache.GetTopAnswerEntry(query_weather_lv).full_query_text.empty()); | 112 cache.GetTopAnswerEntry(query_weather_lv).full_query_text.empty()); |
113 } | 113 } |
OLD | NEW |