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

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

Issue 6758031: Implement a simple Extension App Omnibox provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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/format_macros.h" 5 #include "base/format_macros.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/autocomplete/autocomplete.h" 8 #include "chrome/browser/autocomplete/autocomplete.h"
9 #include "chrome/browser/autocomplete/autocomplete_edit.h" 9 #include "chrome/browser/autocomplete/autocomplete_edit.h"
10 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" 10 #include "chrome/browser/autocomplete/autocomplete_edit_view.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 { 108 {
109 autocomplete_controller->Start( 109 autocomplete_controller->Start(
110 ASCIIToUTF16("chrome"), string16(), true, false, true, 110 ASCIIToUTF16("chrome"), string16(), true, false, true,
111 AutocompleteInput::SYNCHRONOUS_MATCHES); 111 AutocompleteInput::SYNCHRONOUS_MATCHES);
112 112
113 EXPECT_TRUE(autocomplete_controller->done()); 113 EXPECT_TRUE(autocomplete_controller->done());
114 EXPECT_TRUE(location_bar->GetInputString().empty()); 114 EXPECT_TRUE(location_bar->GetInputString().empty());
115 EXPECT_TRUE(location_bar->location_entry()->GetText().empty()); 115 EXPECT_TRUE(location_bar->location_entry()->GetText().empty());
116 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); 116 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll());
117 const AutocompleteResult& result = autocomplete_controller->result(); 117 const AutocompleteResult& result = autocomplete_controller->result();
118 ASSERT_EQ(1U, result.size()) << AutocompleteResultAsString(result); 118 // We get two matches because we have a provider for extension apps and the
119 // Chrome Web Store is a built-in Extension app. For this test, we only care
120 // about the other match existing.
121 ASSERT_GE(result.size(), 1U) << AutocompleteResultAsString(result);
119 AutocompleteMatch match = result.match_at(0); 122 AutocompleteMatch match = result.match_at(0);
120 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); 123 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type);
121 EXPECT_FALSE(match.deletable); 124 EXPECT_FALSE(match.deletable);
122 } 125 }
123 126
124 { 127 {
125 location_bar->Revert(); 128 location_bar->Revert();
126 129
127 EXPECT_TRUE(location_bar->GetInputString().empty()); 130 EXPECT_TRUE(location_bar->GetInputString().empty());
128 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), 131 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL),
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 EXPECT_EQ(ASCIIToUTF16(" ?foo"), 241 EXPECT_EQ(ASCIIToUTF16(" ?foo"),
239 location_bar->location_entry()->GetText()); 242 location_bar->location_entry()->GetText());
240 243
241 size_t selection_start, selection_end; 244 size_t selection_start, selection_end;
242 location_bar->location_entry()->GetSelectionBounds(&selection_start, 245 location_bar->location_entry()->GetSelectionBounds(&selection_start,
243 &selection_end); 246 &selection_end);
244 EXPECT_EQ(4U, std::min(selection_start, selection_end)); 247 EXPECT_EQ(4U, std::min(selection_start, selection_end));
245 EXPECT_EQ(7U, std::max(selection_start, selection_end)); 248 EXPECT_EQ(7U, std::max(selection_start, selection_end));
246 } 249 }
247 } 250 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete.cc ('k') | chrome/browser/autocomplete/autocomplete_match.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698