Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: chrome/browser/autocomplete/history_contents_provider_unittest.cc

Issue 165455: Autocomplete suggestions for bookmark TitleMatch's does not order matching bo... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/autocomplete/autocomplete.h" 8 #include "chrome/browser/autocomplete/autocomplete.h"
9 #include "chrome/browser/autocomplete/history_contents_provider.h" 9 #include "chrome/browser/autocomplete/history_contents_provider.h"
10 #include "chrome/browser/history/history.h" 10 #include "chrome/browser/history/history.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 scoped_refptr<HistoryContentsProvider> provider_; 94 scoped_refptr<HistoryContentsProvider> provider_;
95 }; 95 };
96 96
97 TEST_F(HistoryContentsProviderTest, Body) { 97 TEST_F(HistoryContentsProviderTest, Body) {
98 AutocompleteInput input(L"FOO", std::wstring(), true, false, false); 98 AutocompleteInput input(L"FOO", std::wstring(), true, false, false);
99 RunQuery(input, false); 99 RunQuery(input, false);
100 100
101 // The results should be the first two pages, in decreasing order. 101 // The results should be the first two pages, in decreasing order.
102 const ACMatches& m = matches(); 102 const ACMatches& m = matches();
103 ASSERT_EQ(2U, m.size()); 103 ASSERT_EQ(2U, m.size());
104 EXPECT_EQ(test_entries[1].url, m[0].destination_url.spec()); 104 EXPECT_EQ(test_entries[0].url, m[0].destination_url.spec());
105 EXPECT_STREQ(test_entries[1].title, m[0].description.c_str()); 105 EXPECT_STREQ(test_entries[0].title, m[0].description.c_str());
106 EXPECT_EQ(test_entries[0].url, m[1].destination_url.spec()); 106 EXPECT_EQ(test_entries[1].url, m[1].destination_url.spec());
107 EXPECT_STREQ(test_entries[0].title, m[1].description.c_str()); 107 EXPECT_STREQ(test_entries[1].title, m[1].description.c_str());
108 } 108 }
109 109
110 TEST_F(HistoryContentsProviderTest, Title) { 110 TEST_F(HistoryContentsProviderTest, Title) {
111 AutocompleteInput input(L"PAGEONE", std::wstring(), true, false, false); 111 AutocompleteInput input(L"PAGEONE", std::wstring(), true, false, false);
112 RunQuery(input, false); 112 RunQuery(input, false);
113 113
114 // The results should be the first two pages. 114 // The results should be the first two pages.
115 const ACMatches& m = matches(); 115 const ACMatches& m = matches();
116 ASSERT_EQ(2U, m.size()); 116 ASSERT_EQ(2U, m.size());
117 EXPECT_EQ(test_entries[1].url, m[0].destination_url.spec()); 117 EXPECT_EQ(test_entries[0].url, m[0].destination_url.spec());
118 EXPECT_STREQ(test_entries[1].title, m[0].description.c_str()); 118 EXPECT_STREQ(test_entries[0].title, m[0].description.c_str());
119 EXPECT_EQ(test_entries[0].url, m[1].destination_url.spec()); 119 EXPECT_EQ(test_entries[1].url, m[1].destination_url.spec());
120 EXPECT_STREQ(test_entries[0].title, m[1].description.c_str()); 120 EXPECT_STREQ(test_entries[1].title, m[1].description.c_str());
121 } 121 }
122 122
123 // The "minimal changes" flag should mean that we don't re-query the DB. 123 // The "minimal changes" flag should mean that we don't re-query the DB.
124 TEST_F(HistoryContentsProviderTest, MinimalChanges) { 124 TEST_F(HistoryContentsProviderTest, MinimalChanges) {
125 // A minimal changes request when there have been no real queries should 125 // A minimal changes request when there have been no real queries should
126 // give us no results. 126 // give us no results.
127 AutocompleteInput sync_input(L"PAGEONE", std::wstring(), true, false, true); 127 AutocompleteInput sync_input(L"PAGEONE", std::wstring(), true, false, true);
128 RunQuery(sync_input, true); 128 RunQuery(sync_input, true);
129 const ACMatches& m1 = matches(); 129 const ACMatches& m1 = matches();
130 EXPECT_EQ(0U, m1.size()); 130 EXPECT_EQ(0U, m1.size());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ASSERT_EQ(2U, m3.size()); 175 ASSERT_EQ(2U, m3.size());
176 if (bookmark_url == m3[0].destination_url) { 176 if (bookmark_url == m3[0].destination_url) {
177 EXPECT_EQ("http://www.google.com/3", m3[1].destination_url.spec()); 177 EXPECT_EQ("http://www.google.com/3", m3[1].destination_url.spec());
178 } else { 178 } else {
179 EXPECT_EQ(bookmark_url, m3[1].destination_url); 179 EXPECT_EQ(bookmark_url, m3[1].destination_url);
180 EXPECT_EQ("http://www.google.com/3", m3[0].destination_url.spec()); 180 EXPECT_EQ("http://www.google.com/3", m3[0].destination_url.spec());
181 } 181 }
182 } 182 }
183 183
184 } // namespace 184 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_contents_provider.cc ('k') | chrome/browser/bookmarks/bookmark_index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698