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

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

Issue 23804002: Make OmniboxEditModel::UpdatePermanentText() fetch the new text itself rather (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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) 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/strings/utf_string_conversions.h" 5 #include "base/strings/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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // NOTE: The TemplateURLService must be created before the 185 // NOTE: The TemplateURLService must be created before the
186 // AutocompleteClassifier so that the SearchProvider gets a non-NULL 186 // AutocompleteClassifier so that the SearchProvider gets a non-NULL
187 // TemplateURLService at construction time. 187 // TemplateURLService at construction time.
188 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 188 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
189 &profile, &TemplateURLServiceFactory::BuildInstanceFor); 189 &profile, &TemplateURLServiceFactory::BuildInstanceFor);
190 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse( 190 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
191 &profile, &AutocompleteClassifierFactory::BuildInstanceFor); 191 &profile, &AutocompleteClassifierFactory::BuildInstanceFor);
192 OmniboxEditModel model(&view, &controller, &profile); 192 OmniboxEditModel model(&view, &controller, &profile);
193 193
194 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { 194 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) {
195 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); 195 toolbar_model()->set_text(ASCIIToUTF16(input[i].perm_text));
196 model.UpdatePermanentText();
196 197
197 toolbar_model()->set_replace_search_url_with_search_terms( 198 toolbar_model()->set_replace_search_url_with_search_terms(
198 input[i].extracted_search_terms); 199 input[i].extracted_search_terms);
199 200
200 string16 result = ASCIIToUTF16(input[i].input); 201 string16 result = ASCIIToUTF16(input[i].input);
201 GURL url; 202 GURL url;
202 bool write_url; 203 bool write_url;
203 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, 204 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected,
204 &result, &url, &write_url); 205 &result, &url, &write_url);
205 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; 206 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i;
206 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; 207 EXPECT_EQ(input[i].write_url, write_url) << " @" << i;
207 if (write_url) 208 if (write_url)
208 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; 209 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i;
209 } 210 }
210 } 211 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | chrome/browser/ui/omnibox/omnibox_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698