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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_unittest.cc

Issue 14259008: Instant Extended: Add prominent search term support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 6 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
7 #include "chrome/browser/search_engines/template_url_service_factory.h" 7 #include "chrome/browser/search_engines/template_url_service_factory.h"
8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" 8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
9 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 9 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
10 #include "chrome/browser/ui/omnibox/omnibox_view.h" 10 #include "chrome/browser/ui/omnibox/omnibox_view.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // TemplateURLService at construction time. 181 // TemplateURLService at construction time.
182 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 182 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
183 &profile, &TemplateURLServiceFactory::BuildInstanceFor); 183 &profile, &TemplateURLServiceFactory::BuildInstanceFor);
184 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse( 184 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
185 &profile, &AutocompleteClassifierFactory::BuildInstanceFor); 185 &profile, &AutocompleteClassifierFactory::BuildInstanceFor);
186 OmniboxEditModel model(&view, &controller, &profile); 186 OmniboxEditModel model(&view, &controller, &profile);
187 187
188 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { 188 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) {
189 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); 189 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text));
190 190
191 toolbar_model()->set_replace_search_url_with_search_terms( 191 toolbar_model()->set_search_terms_type(input[i].extracted_search_terms ?
192 input[i].extracted_search_terms); 192 ToolbarModel::NORMAL_SEARCH_TERMS : ToolbarModel::NO_SEARCH_TERMS);
193 193
194 string16 result = ASCIIToUTF16(input[i].input); 194 string16 result = ASCIIToUTF16(input[i].input);
195 GURL url; 195 GURL url;
196 bool write_url; 196 bool write_url;
197 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, 197 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected,
198 &result, &url, &write_url); 198 &result, &url, &write_url);
199 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; 199 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i;
200 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; 200 EXPECT_EQ(input[i].write_url, write_url) << " @" << i;
201 if (write_url) 201 if (write_url)
202 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; 202 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i;
203 } 203 }
204 } 204 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | chrome/browser/ui/search/instant_extended_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698