| OLD | NEW |
| 1 // Copyright (c) 2010 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/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.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" |
| 11 #include "chrome/browser/autocomplete/autocomplete_match.h" | 11 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // enter "extension keyword" mode. | 101 // enter "extension keyword" mode. |
| 102 const AutocompleteResult& result = autocomplete_controller->result(); | 102 const AutocompleteResult& result = autocomplete_controller->result(); |
| 103 ASSERT_EQ(2U, result.size()) << AutocompleteResultAsString(result); | 103 ASSERT_EQ(2U, result.size()) << AutocompleteResultAsString(result); |
| 104 AutocompleteMatch match = result.match_at(0); | 104 AutocompleteMatch match = result.match_at(0); |
| 105 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); | 105 EXPECT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, match.type); |
| 106 EXPECT_FALSE(match.deletable); | 106 EXPECT_FALSE(match.deletable); |
| 107 | 107 |
| 108 match = result.match_at(1); | 108 match = result.match_at(1); |
| 109 ASSERT_TRUE(match.template_url); | 109 ASSERT_TRUE(match.template_url); |
| 110 EXPECT_TRUE(match.template_url->IsExtensionKeyword()); | 110 EXPECT_TRUE(match.template_url->IsExtensionKeyword()); |
| 111 EXPECT_EQ(L"keyword", match.template_url->keyword()); | 111 EXPECT_EQ(ASCIIToUTF16("keyword"), match.template_url->keyword()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Test that our extension can send suggestions back to us. | 114 // Test that our extension can send suggestions back to us. |
| 115 { | 115 { |
| 116 autocomplete_controller->Start(L"keyword suggestio", std::wstring(), | 116 autocomplete_controller->Start(L"keyword suggestio", std::wstring(), |
| 117 true, false, true, false); | 117 true, false, true, false); |
| 118 | 118 |
| 119 WaitForAutocompleteDone(autocomplete_controller); | 119 WaitForAutocompleteDone(autocomplete_controller); |
| 120 EXPECT_TRUE(autocomplete_controller->done()); | 120 EXPECT_TRUE(autocomplete_controller->done()); |
| 121 | 121 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 172 } |
| 173 | 173 |
| 174 { | 174 { |
| 175 ResultCatcher catcher; | 175 ResultCatcher catcher; |
| 176 autocomplete_controller->Start(L"keyword command", std::wstring(), | 176 autocomplete_controller->Start(L"keyword command", std::wstring(), |
| 177 true, false, true, false); | 177 true, false, true, false); |
| 178 location_bar->AcceptInput(); | 178 location_bar->AcceptInput(); |
| 179 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 179 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 180 } | 180 } |
| 181 } | 181 } |
| OLD | NEW |