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

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

Issue 9419043: Revert 122412 - Enabled pressing TAB to traverse through the Omnibox results (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_edit.h" 6 #include "chrome/browser/autocomplete/autocomplete_edit.h"
7 #include "chrome/browser/ui/omnibox/omnibox_view.h" 7 #include "chrome/browser/ui/omnibox/omnibox_view.h"
8 #include "chrome/test/base/testing_browser_process.h" 8 #include "chrome/test/base/testing_browser_process.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 17 matching lines...) Expand all
28 size_t selected_line, 28 size_t selected_line,
29 const string16& keyword) OVERRIDE {} 29 const string16& keyword) OVERRIDE {}
30 virtual string16 GetText() const OVERRIDE { return string16(); } 30 virtual string16 GetText() const OVERRIDE { return string16(); }
31 virtual bool IsEditingOrEmpty() const OVERRIDE { return true; } 31 virtual bool IsEditingOrEmpty() const OVERRIDE { return true; }
32 virtual int GetIcon() const OVERRIDE { return 0; } 32 virtual int GetIcon() const OVERRIDE { return 0; }
33 virtual void SetUserText(const string16& text) OVERRIDE {} 33 virtual void SetUserText(const string16& text) OVERRIDE {}
34 virtual void SetUserText(const string16& text, 34 virtual void SetUserText(const string16& text,
35 const string16& display_text, 35 const string16& display_text,
36 bool update_popup) OVERRIDE {} 36 bool update_popup) OVERRIDE {}
37 virtual void SetWindowTextAndCaretPos(const string16& text, 37 virtual void SetWindowTextAndCaretPos(const string16& text,
38 size_t caret_pos, 38 size_t caret_pos) OVERRIDE {}
39 bool update_popup,
40 bool notify_text_changed) OVERRIDE {}
41 virtual void SetForcedQuery() OVERRIDE {} 39 virtual void SetForcedQuery() OVERRIDE {}
42 virtual bool IsSelectAll() OVERRIDE { return false; } 40 virtual bool IsSelectAll() OVERRIDE { return false; }
43 virtual bool DeleteAtEndPressed() OVERRIDE { return false; } 41 virtual bool DeleteAtEndPressed() OVERRIDE { return false; }
44 virtual void GetSelectionBounds(size_t* start, size_t* end) const OVERRIDE {} 42 virtual void GetSelectionBounds(size_t* start, size_t* end) const OVERRIDE {}
45 virtual void SelectAll(bool reversed) OVERRIDE {} 43 virtual void SelectAll(bool reversed) OVERRIDE {}
46 virtual void RevertAll() OVERRIDE {} 44 virtual void RevertAll() OVERRIDE {}
47 virtual void UpdatePopup() OVERRIDE {} 45 virtual void UpdatePopup() OVERRIDE {}
48 virtual void ClosePopup() OVERRIDE {} 46 virtual void ClosePopup() OVERRIDE {}
49 virtual void SetFocus() OVERRIDE {} 47 virtual void SetFocus() OVERRIDE {}
50 virtual void OnTemporaryTextMaybeChanged( 48 virtual void OnTemporaryTextMaybeChanged(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 148
151 // Makes sure intranet urls get 'http://' prefixed to them. 149 // Makes sure intranet urls get 'http://' prefixed to them.
152 { "b/foo", 0, true, "b/foo", "http://b/foo", true, "http://b/foo" }, 150 { "b/foo", 0, true, "b/foo", "http://b/foo", true, "http://b/foo" },
153 151
154 // Verifies a search term 'foo' doesn't end up with http. 152 // Verifies a search term 'foo' doesn't end up with http.
155 { "www.google.com/search?", 0, false, "foo", "foo", false, "" }, 153 { "www.google.com/search?", 0, false, "foo", "foo", false, "" },
156 }; 154 };
157 TestingOmniboxView view; 155 TestingOmniboxView view;
158 TestingAutocompleteEditController controller; 156 TestingAutocompleteEditController controller;
159 TestingProfile profile; 157 TestingProfile profile;
158 AutocompleteEditModel model(&view, &controller, &profile);
159 profile.CreateAutocompleteClassifier();
160 profile.CreateTemplateURLService(); 160 profile.CreateTemplateURLService();
161 profile.CreateAutocompleteClassifier();
162 AutocompleteEditModel model(&view, &controller, &profile);
163 161
164 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { 162 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) {
165 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); 163 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text));
166 164
167 string16 result = ASCIIToUTF16(input[i].input); 165 string16 result = ASCIIToUTF16(input[i].input);
168 GURL url; 166 GURL url;
169 bool write_url; 167 bool write_url;
170 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, 168 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected,
171 &result, &url, &write_url); 169 &result, &url, &write_url);
172 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; 170 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i;
173 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; 171 EXPECT_EQ(input[i].write_url, write_url) << " @" << i;
174 if (write_url) 172 if (write_url)
175 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; 173 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i;
176 } 174 }
177 } 175 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit.cc ('k') | chrome/browser/autocomplete/autocomplete_match.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698