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

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

Issue 12623029: Upstreaming mechanism to add query refinement to omnibox searches. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied Peter's comments. Created 7 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_classifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/format_macros.h" 5 #include "base/format_macros.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/autocomplete/autocomplete_input.h" 9 #include "chrome/browser/autocomplete/autocomplete_input.h"
10 #include "chrome/browser/autocomplete/autocomplete_match.h" 10 #include "chrome/browser/autocomplete/autocomplete_match.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // loaded so that the autocomplete results are consistent. 114 // loaded so that the autocomplete results are consistent.
115 ui_test_utils::WaitForHistoryToLoad( 115 ui_test_utils::WaitForHistoryToLoad(
116 HistoryServiceFactory::GetForProfile(browser()->profile(), 116 HistoryServiceFactory::GetForProfile(browser()->profile(),
117 Profile::EXPLICIT_ACCESS)); 117 Profile::EXPLICIT_ACCESS));
118 118
119 LocationBar* location_bar = GetLocationBar(); 119 LocationBar* location_bar = GetLocationBar();
120 AutocompleteController* autocomplete_controller = GetAutocompleteController(); 120 AutocompleteController* autocomplete_controller = GetAutocompleteController();
121 121
122 { 122 {
123 autocomplete_controller->Start(AutocompleteInput( 123 autocomplete_controller->Start(AutocompleteInput(
124 ASCIIToUTF16("chrome"), string16::npos, string16(), true, false, true, 124 ASCIIToUTF16("chrome"), string16::npos, string16(), GURL(), true, false,
125 AutocompleteInput::SYNCHRONOUS_MATCHES)); 125 true, AutocompleteInput::SYNCHRONOUS_MATCHES));
126 126
127 OmniboxView* location_entry = location_bar->GetLocationEntry(); 127 OmniboxView* location_entry = location_bar->GetLocationEntry();
128 128
129 EXPECT_TRUE(autocomplete_controller->done()); 129 EXPECT_TRUE(autocomplete_controller->done());
130 EXPECT_TRUE(location_bar->GetInputString().empty()); 130 EXPECT_TRUE(location_bar->GetInputString().empty());
131 EXPECT_TRUE(location_entry->GetText().empty()); 131 EXPECT_TRUE(location_entry->GetText().empty());
132 EXPECT_TRUE(location_entry->IsSelectAll()); 132 EXPECT_TRUE(location_entry->IsSelectAll());
133 const AutocompleteResult& result = autocomplete_controller->result(); 133 const AutocompleteResult& result = autocomplete_controller->result();
134 // We get two matches because we have a provider for extension apps and the 134 // We get two matches because we have a provider for extension apps and the
135 // Chrome Web Store is a built-in Extension app. For this test, we only care 135 // Chrome Web Store is a built-in Extension app. For this test, we only care
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 location_bar->FocusSearch(); 252 location_bar->FocusSearch();
253 EXPECT_TRUE(location_bar->GetInputString().empty()); 253 EXPECT_TRUE(location_bar->GetInputString().empty());
254 EXPECT_EQ(ASCIIToUTF16(" ?foo"), location_entry->GetText()); 254 EXPECT_EQ(ASCIIToUTF16(" ?foo"), location_entry->GetText());
255 255
256 size_t selection_start, selection_end; 256 size_t selection_start, selection_end;
257 location_entry->GetSelectionBounds(&selection_start, &selection_end); 257 location_entry->GetSelectionBounds(&selection_start, &selection_end);
258 EXPECT_EQ(4U, std::min(selection_start, selection_end)); 258 EXPECT_EQ(4U, std::min(selection_start, selection_end));
259 EXPECT_EQ(7U, std::max(selection_start, selection_end)); 259 EXPECT_EQ(7U, std::max(selection_start, selection_end));
260 } 260 }
261 } 261 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_classifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698