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

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

Issue 1912: Renames BoomarkBarModel to BookmarkModel. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const ACMatches& m2 = matches(); 141 const ACMatches& m2 = matches();
142 EXPECT_EQ(2, m2.size()); 142 EXPECT_EQ(2, m2.size());
143 143
144 // Now do a minimal one where we want synchronous results, and the results 144 // Now do a minimal one where we want synchronous results, and the results
145 // should still be there. 145 // should still be there.
146 RunQuery(input, true, true); 146 RunQuery(input, true, true);
147 const ACMatches& m3 = matches(); 147 const ACMatches& m3 = matches();
148 EXPECT_EQ(2, m3.size()); 148 EXPECT_EQ(2, m3.size());
149 } 149 }
150 150
151 // Tests that the BookmarkBarModel is queried correctly. 151 // Tests that the BookmarkModel is queried correctly.
152 TEST_F(HistoryContentsProviderTest, Bookmarks) { 152 TEST_F(HistoryContentsProviderTest, Bookmarks) {
153 profile()->CreateBookmarkBarModel(false); 153 profile()->CreateBookmarkModel(false);
154 profile()->BlockUntilBookmarkModelLoaded(); 154 profile()->BlockUntilBookmarkModelLoaded();
155 155
156 // Add a bookmark. 156 // Add a bookmark.
157 GURL bookmark_url("http://www.google.com/4"); 157 GURL bookmark_url("http://www.google.com/4");
158 profile()->GetBookmarkBarModel()->SetURLStarred(bookmark_url, L"bar", true); 158 profile()->GetBookmarkModel()->SetURLStarred(bookmark_url, L"bar", true);
159 159
160 AutocompleteInput input(L"bar", std::wstring(), true); 160 AutocompleteInput input(L"bar", std::wstring(), true);
161 161
162 // Ask for synchronous. This should only get the bookmark. 162 // Ask for synchronous. This should only get the bookmark.
163 RunQuery(input, false, true); 163 RunQuery(input, false, true);
164 const ACMatches& m1 = matches(); 164 const ACMatches& m1 = matches();
165 ASSERT_EQ(1, m1.size()); 165 ASSERT_EQ(1, m1.size());
166 EXPECT_EQ(bookmark_url.spec(), WideToUTF8(m1[0].destination_url)); 166 EXPECT_EQ(bookmark_url.spec(), WideToUTF8(m1[0].destination_url));
167 EXPECT_EQ(L"bar", m1[0].description); 167 EXPECT_EQ(L"bar", m1[0].description);
168 EXPECT_TRUE(m1[0].starred); 168 EXPECT_TRUE(m1[0].starred);
(...skipping 10 matching lines...) Expand all
179 // We should two urls now, bookmark_url and http://www.google.com/3. 179 // We should two urls now, bookmark_url and http://www.google.com/3.
180 const ACMatches& m3 = matches(); 180 const ACMatches& m3 = matches();
181 ASSERT_EQ(2, m3.size()); 181 ASSERT_EQ(2, m3.size());
182 if (bookmark_url.spec() == WideToUTF8(m3[0].destination_url)) { 182 if (bookmark_url.spec() == WideToUTF8(m3[0].destination_url)) {
183 EXPECT_EQ(L"http://www.google.com/3", m3[1].destination_url); 183 EXPECT_EQ(L"http://www.google.com/3", m3[1].destination_url);
184 } else { 184 } else {
185 EXPECT_EQ(bookmark_url.spec(), WideToUTF8(m3[1].destination_url)); 185 EXPECT_EQ(bookmark_url.spec(), WideToUTF8(m3[1].destination_url));
186 EXPECT_EQ(L"http://www.google.com/3", m3[0].destination_url); 186 EXPECT_EQ(L"http://www.google.com/3", m3[0].destination_url);
187 } 187 }
188 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698