OLD | NEW |
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/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.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 10 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Test that our extension's keyword is suggested to us when we partially type | 103 // Test that our extension's keyword is suggested to us when we partially type |
104 // it. | 104 // it. |
105 { | 105 { |
106 autocomplete_controller->Start( | 106 autocomplete_controller->Start( |
107 ASCIIToUTF16("keywor"), string16(), true, false, true, | 107 ASCIIToUTF16("keywor"), string16(), true, false, true, |
108 AutocompleteInput::ALL_MATCHES); | 108 AutocompleteInput::ALL_MATCHES); |
109 | 109 |
110 WaitForAutocompleteDone(autocomplete_controller); | 110 WaitForAutocompleteDone(autocomplete_controller); |
111 EXPECT_TRUE(autocomplete_controller->done()); | 111 EXPECT_TRUE(autocomplete_controller->done()); |
112 EXPECT_EQ(std::wstring(), location_bar->GetInputString()); | 112 EXPECT_EQ(string16(), location_bar->GetInputString()); |
113 EXPECT_EQ(string16(), location_bar->location_entry()->GetText()); | 113 EXPECT_EQ(string16(), location_bar->location_entry()->GetText()); |
114 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); | 114 EXPECT_TRUE(location_bar->location_entry()->IsSelectAll()); |
115 | 115 |
116 // First result should be to search for what was typed, second should be to | 116 // First result should be to search for what was typed, second should be to |
117 // enter "extension keyword" mode. | 117 // enter "extension keyword" mode. |
118 const AutocompleteResult& result = autocomplete_controller->result(); | 118 const AutocompleteResult& result = autocomplete_controller->result(); |
119 ASSERT_EQ(2U, result.size()) << AutocompleteResultAsString(result); | 119 ASSERT_EQ(2U, result.size()) << AutocompleteResultAsString(result); |
120 AutocompleteMatch match = result.match_at(0); | 120 AutocompleteMatch match = result.match_at(0); |
121 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); | 121 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); |
122 EXPECT_FALSE(match.deletable); | 122 EXPECT_FALSE(match.deletable); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ResultCatcher catcher; | 240 ResultCatcher catcher; |
241 autocomplete_controller->Start( | 241 autocomplete_controller->Start( |
242 ASCIIToUTF16("keyword command"), string16(), true, false, true, | 242 ASCIIToUTF16("keyword command"), string16(), true, false, true, |
243 AutocompleteInput::ALL_MATCHES); | 243 AutocompleteInput::ALL_MATCHES); |
244 location_bar->AcceptInput(); | 244 location_bar->AcceptInput(); |
245 WaitForAutocompleteDone(autocomplete_controller); | 245 WaitForAutocompleteDone(autocomplete_controller); |
246 EXPECT_TRUE(autocomplete_controller->done()); | 246 EXPECT_TRUE(autocomplete_controller->done()); |
247 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 247 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
248 EXPECT_FALSE(popup_model->IsOpen()); | 248 EXPECT_FALSE(popup_model->IsOpen()); |
249 } | 249 } |
OLD | NEW |