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

Side by Side Diff: chrome/browser/extensions/api/omnibox/omnibox_api_browsertest.cc

Issue 14698028: Omnibox refactor. OmniboxController now holds an AutocompleteMatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed failing browser tests. Created 7 years, 6 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/string16.h" 5 #include "base/strings/string16.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/autocomplete/autocomplete_controller.h" 7 #include "chrome/browser/autocomplete/autocomplete_controller.h"
8 #include "chrome/browser/autocomplete/autocomplete_input.h" 8 #include "chrome/browser/autocomplete/autocomplete_input.h"
9 #include "chrome/browser/autocomplete/autocomplete_match.h" 9 #include "chrome/browser/autocomplete/autocomplete_match.h"
10 #include "chrome/browser/autocomplete/autocomplete_result.h" 10 #include "chrome/browser/autocomplete/autocomplete_result.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; 153 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_;
154 ui_test_utils::WaitForTemplateURLServiceToLoad( 154 ui_test_utils::WaitForTemplateURLServiceToLoad(
155 TemplateURLServiceFactory::GetForProfile(browser()->profile())); 155 TemplateURLServiceFactory::GetForProfile(browser()->profile()));
156 156
157 LocationBar* location_bar = GetLocationBar(browser()); 157 LocationBar* location_bar = GetLocationBar(browser());
158 OmniboxView* omnibox_view = location_bar->GetLocationEntry(); 158 OmniboxView* omnibox_view = location_bar->GetLocationEntry();
159 ResultCatcher catcher; 159 ResultCatcher catcher;
160 AutocompleteController* autocomplete_controller = 160 AutocompleteController* autocomplete_controller =
161 GetAutocompleteController(browser()); 161 GetAutocompleteController(browser());
162 omnibox_view->OnBeforePossibleChange(); 162 omnibox_view->OnBeforePossibleChange();
163 omnibox_view->SetUserText(string16()); 163 omnibox_view->SetUserText(ASCIIToUTF16("keyword command"));
164 omnibox_view->OnAfterPossibleChange(); 164 omnibox_view->OnAfterPossibleChange();
165 165
166 autocomplete_controller->Start( 166 autocomplete_controller->Start(
167 AutocompleteInput(ASCIIToUTF16("keyword command"), string16::npos, 167 AutocompleteInput(ASCIIToUTF16("keyword command"), string16::npos,
168 string16(), GURL(), true, false, true, 168 string16(), GURL(), true, false, true,
169 AutocompleteInput::ALL_MATCHES)); 169 AutocompleteInput::ALL_MATCHES));
170 location_bar->GetLocationEntry()->model()->AcceptInput( 170 location_bar->GetLocationEntry()->model()->AcceptInput(
171 CURRENT_TAB, 171 CURRENT_TAB,
172 false); // Not for drop operation. 172 false); // Not for drop operation.
173 WaitForAutocompleteDone(autocomplete_controller); 173 WaitForAutocompleteDone(autocomplete_controller);
174 EXPECT_TRUE(autocomplete_controller->done()); 174 EXPECT_TRUE(autocomplete_controller->done());
175 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 175 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
176 176
177 omnibox_view->OnBeforePossibleChange(); 177 omnibox_view->OnBeforePossibleChange();
178 omnibox_view->SetUserText(string16()); 178 omnibox_view->SetUserText(ASCIIToUTF16("keyword newtab"));
179 omnibox_view->OnAfterPossibleChange(); 179 omnibox_view->OnAfterPossibleChange();
180 WaitForAutocompleteDone(autocomplete_controller); 180 WaitForAutocompleteDone(autocomplete_controller);
181 EXPECT_TRUE(autocomplete_controller->done()); 181 EXPECT_TRUE(autocomplete_controller->done());
182 182
183 autocomplete_controller->Start( 183 autocomplete_controller->Start(
184 AutocompleteInput(ASCIIToUTF16("keyword newtab"), string16::npos, 184 AutocompleteInput(ASCIIToUTF16("keyword newtab"), string16::npos,
185 string16(), GURL(), true, false, true, 185 string16(), GURL(), true, false, true,
186 AutocompleteInput::ALL_MATCHES)); 186 AutocompleteInput::ALL_MATCHES));
187 location_bar->GetLocationEntry()->model()->AcceptInput( 187 location_bar->GetLocationEntry()->model()->AcceptInput(
188 NEW_FOREGROUND_TAB, 188 NEW_FOREGROUND_TAB,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 { 242 {
243 ResultCatcher catcher; 243 ResultCatcher catcher;
244 autocomplete_controller->Start( 244 autocomplete_controller->Start(
245 AutocompleteInput(ASCIIToUTF16("keyword command incognito"), 245 AutocompleteInput(ASCIIToUTF16("keyword command incognito"),
246 string16::npos, string16(), GURL(), true, false, true, 246 string16::npos, string16(), GURL(), true, false, true,
247 AutocompleteInput::ALL_MATCHES)); 247 AutocompleteInput::ALL_MATCHES));
248 location_bar->AcceptInput(); 248 location_bar->AcceptInput();
249 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 249 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
250 } 250 }
251 } 251 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_result.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698