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

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

Issue 6731036: Enabled pressing TAB to cycle through the Omnibox results. (Closed) Base URL: http://src.chromium.org/svn/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) OVERRIDE {} 38 size_t caret_pos,
39 bool update_popup,
40 bool notify_text_changed) OVERRIDE {}
39 virtual void SetForcedQuery() OVERRIDE {} 41 virtual void SetForcedQuery() OVERRIDE {}
40 virtual bool IsSelectAll() OVERRIDE { return false; } 42 virtual bool IsSelectAll() OVERRIDE { return false; }
41 virtual bool DeleteAtEndPressed() OVERRIDE { return false; } 43 virtual bool DeleteAtEndPressed() OVERRIDE { return false; }
42 virtual void GetSelectionBounds(size_t* start, size_t* end) const OVERRIDE {} 44 virtual void GetSelectionBounds(size_t* start, size_t* end) const OVERRIDE {}
43 virtual void SelectAll(bool reversed) OVERRIDE {} 45 virtual void SelectAll(bool reversed) OVERRIDE {}
44 virtual void RevertAll() OVERRIDE {} 46 virtual void RevertAll() OVERRIDE {}
45 virtual void UpdatePopup() OVERRIDE {} 47 virtual void UpdatePopup() OVERRIDE {}
46 virtual void ClosePopup() OVERRIDE {} 48 virtual void ClosePopup() OVERRIDE {}
47 virtual void SetFocus() OVERRIDE {} 49 virtual void SetFocus() OVERRIDE {}
48 virtual void OnTemporaryTextMaybeChanged( 50 virtual void OnTemporaryTextMaybeChanged(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 150
149 // Makes sure intranet urls get 'http://' prefixed to them. 151 // Makes sure intranet urls get 'http://' prefixed to them.
150 { "b/foo", 0, true, "b/foo", "http://b/foo", true, "http://b/foo" }, 152 { "b/foo", 0, true, "b/foo", "http://b/foo", true, "http://b/foo" },
151 153
152 // Verifies a search term 'foo' doesn't end up with http. 154 // Verifies a search term 'foo' doesn't end up with http.
153 { "www.google.com/search?", 0, false, "foo", "foo", false, "" }, 155 { "www.google.com/search?", 0, false, "foo", "foo", false, "" },
154 }; 156 };
155 TestingOmniboxView view; 157 TestingOmniboxView view;
156 TestingAutocompleteEditController controller; 158 TestingAutocompleteEditController controller;
157 TestingProfile profile; 159 TestingProfile profile;
160 profile.CreateTemplateURLService();
161 profile.CreateAutocompleteClassifier();
158 AutocompleteEditModel model(&view, &controller, &profile); 162 AutocompleteEditModel model(&view, &controller, &profile);
159 profile.CreateAutocompleteClassifier();
160 profile.CreateTemplateURLService();
161 163
162 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) { 164 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) {
163 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text)); 165 model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text));
164 166
165 string16 result = ASCIIToUTF16(input[i].input); 167 string16 result = ASCIIToUTF16(input[i].input);
166 GURL url; 168 GURL url;
167 bool write_url; 169 bool write_url;
168 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, 170 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected,
169 &result, &url, &write_url); 171 &result, &url, &write_url);
170 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; 172 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i;
171 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; 173 EXPECT_EQ(input[i].write_url, write_url) << " @" << i;
172 if (write_url) 174 if (write_url)
173 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; 175 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i;
174 } 176 }
175 } 177 }
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