Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 | 49 |
| 50 using base::ASCIIToUTF16; | 50 using base::ASCIIToUTF16; |
| 51 using base::UTF16ToUTF8; | 51 using base::UTF16ToUTF8; |
| 52 using base::Time; | 52 using base::Time; |
| 53 using base::TimeDelta; | 53 using base::TimeDelta; |
| 54 | 54 |
| 55 namespace { | 55 namespace { |
| 56 | 56 |
| 57 const char kSearchKeyword[] = "foo"; | 57 const char kSearchKeyword[] = "foo"; |
| 58 const char kSearchKeyword2[] = "footest.com"; | 58 const char kSearchKeyword2[] = "footest.com"; |
| 59 const wchar_t kSearchKeywordKeys[] = { ui::VKEY_F, ui::VKEY_O, ui::VKEY_O, 0 }; | 59 const ui::KeyboardCode kSearchKeywordKeys[] = { |
| 60 ui::VKEY_F, ui::VKEY_O, ui::VKEY_O, ui::VKEY_UNKNOWN | |
| 61 }; | |
| 62 const ui::KeyboardCode kSearchKeywordPrefixKeys[] = { | |
| 63 ui::VKEY_F, ui::VKEY_O, ui::VKEY_UNKNOWN | |
| 64 }; | |
| 65 const ui::KeyboardCode kSearchKeywordCompletionKeys[] = { | |
| 66 ui::VKEY_O, ui::VKEY_UNKNOWN | |
| 67 }; | |
| 60 const char kSearchURL[] = "http://www.foo.com/search?q={searchTerms}"; | 68 const char kSearchURL[] = "http://www.foo.com/search?q={searchTerms}"; |
| 61 const char kSearchShortName[] = "foo"; | 69 const char kSearchShortName[] = "foo"; |
| 62 const char kSearchText[] = "abc"; | 70 const char kSearchText[] = "abc"; |
| 63 const wchar_t kSearchTextKeys[] = { ui::VKEY_A, ui::VKEY_B, ui::VKEY_C, 0 }; | 71 const ui::KeyboardCode kSearchTextKeys[] = { |
| 72 ui::VKEY_A, ui::VKEY_B, ui::VKEY_C, ui::VKEY_UNKNOWN | |
| 73 }; | |
| 64 const char kSearchTextURL[] = "http://www.foo.com/search?q=abc"; | 74 const char kSearchTextURL[] = "http://www.foo.com/search?q=abc"; |
| 65 | 75 |
| 66 const char kInlineAutocompleteText[] = "def"; | 76 const char kInlineAutocompleteText[] = "def"; |
| 67 const wchar_t kInlineAutocompleteTextKeys[] = { | 77 const ui::KeyboardCode kInlineAutocompleteTextKeys[] = { |
| 68 ui::VKEY_D, ui::VKEY_E, ui::VKEY_F, 0 | 78 ui::VKEY_D, ui::VKEY_E, ui::VKEY_F, ui::VKEY_UNKNOWN |
| 69 }; | 79 }; |
| 70 | 80 |
| 71 // Hostnames that shall be blocked by host resolver. | 81 // Hostnames that shall be blocked by host resolver. |
| 72 const char *kBlockedHostnames[] = { | 82 const char *kBlockedHostnames[] = { |
| 73 "foo", | 83 "foo", |
| 74 "*.foo.com", | 84 "*.foo.com", |
| 75 "bar", | 85 "bar", |
| 76 "*.bar.com", | 86 "*.bar.com", |
| 77 "abc", | 87 "abc", |
| 78 "*.abc.com", | 88 "*.abc.com", |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 (modifiers & ui::EF_CONTROL_DOWN) != 0, | 170 (modifiers & ui::EF_CONTROL_DOWN) != 0, |
| 161 (modifiers & ui::EF_SHIFT_DOWN) != 0, | 171 (modifiers & ui::EF_SHIFT_DOWN) != 0, |
| 162 (modifiers & ui::EF_ALT_DOWN) != 0, | 172 (modifiers & ui::EF_ALT_DOWN) != 0, |
| 163 (modifiers & ui::EF_COMMAND_DOWN) != 0)); | 173 (modifiers & ui::EF_COMMAND_DOWN) != 0)); |
| 164 } | 174 } |
| 165 | 175 |
| 166 void SendKey(ui::KeyboardCode key, int modifiers) { | 176 void SendKey(ui::KeyboardCode key, int modifiers) { |
| 167 SendKeyForBrowser(browser(), key, modifiers); | 177 SendKeyForBrowser(browser(), key, modifiers); |
| 168 } | 178 } |
| 169 | 179 |
| 170 void SendKeySequence(const wchar_t* keys) { | 180 void SendKeySequence(const ui::KeyboardCode* keys) { |
| 171 for (; *keys; ++keys) | 181 for (; *keys; ++keys) |
|
Peter Kasting
2014/08/05 23:13:36
Tiny nit: For maximum clarity, we should probably
Mark P
2014/08/05 23:19:38
I can't use 0 because it's the wrong type. (I'd n
| |
| 172 ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<ui::KeyboardCode>(*keys), 0)); | 182 ASSERT_NO_FATAL_FAILURE(SendKey(*keys, 0)); |
| 173 } | 183 } |
| 174 | 184 |
| 175 bool SendKeyAndWait(const Browser* browser, | 185 bool SendKeyAndWait(const Browser* browser, |
| 176 ui::KeyboardCode key, | 186 ui::KeyboardCode key, |
| 177 int modifiers, | 187 int modifiers, |
| 178 int type, | 188 int type, |
| 179 const content::NotificationSource& source) | 189 const content::NotificationSource& source) |
| 180 WARN_UNUSED_RESULT { | 190 WARN_UNUSED_RESULT { |
| 181 return ui_test_utils::SendKeyPressAndWait( | 191 return ui_test_utils::SendKeyPressAndWait( |
| 182 browser, key, | 192 browser, key, |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 } | 566 } |
| 557 #undef MAYBE_ESCAPE | 567 #undef MAYBE_ESCAPE |
| 558 | 568 |
| 559 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLD) { | 569 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLD) { |
| 560 OmniboxView* omnibox_view = NULL; | 570 OmniboxView* omnibox_view = NULL; |
| 561 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 571 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 562 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 572 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
| 563 ASSERT_TRUE(popup_model); | 573 ASSERT_TRUE(popup_model); |
| 564 | 574 |
| 565 // Test ctrl-Enter. | 575 // Test ctrl-Enter. |
| 566 const wchar_t kKeys[] = { ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, 0 }; | 576 const ui::KeyboardCode kKeys[] = { |
| 577 ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, ui::VKEY_UNKNOWN | |
| 578 }; | |
| 567 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kKeys)); | 579 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kKeys)); |
| 568 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 580 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 569 ASSERT_TRUE(popup_model->IsOpen()); | 581 ASSERT_TRUE(popup_model->IsOpen()); |
| 570 // ctrl-Enter triggers desired_tld feature, thus www.bar.com shall be | 582 // ctrl-Enter triggers desired_tld feature, thus www.bar.com shall be |
| 571 // opened. | 583 // opened. |
| 572 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, ui::EF_CONTROL_DOWN, | 584 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, ui::EF_CONTROL_DOWN, |
| 573 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 585 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 574 content::Source<content::NavigationController>( | 586 content::Source<content::NavigationController>( |
| 575 &browser()->tab_strip_model()->GetActiveWebContents()-> | 587 &browser()->tab_strip_model()->GetActiveWebContents()-> |
| 576 GetController()))); | 588 GetController()))); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 593 // Add a non-substituting keyword. This ensures the popup will have a | 605 // Add a non-substituting keyword. This ensures the popup will have a |
| 594 // non-verbatim entry with "ab" as a prefix. This way, by arrowing down, we | 606 // non-verbatim entry with "ab" as a prefix. This way, by arrowing down, we |
| 595 // can set "abc" as temporary text in the omnibox. | 607 // can set "abc" as temporary text in the omnibox. |
| 596 TemplateURLData data; | 608 TemplateURLData data; |
| 597 data.short_name = ASCIIToUTF16("abc"); | 609 data.short_name = ASCIIToUTF16("abc"); |
| 598 data.SetKeyword(ASCIIToUTF16(kSearchText)); | 610 data.SetKeyword(ASCIIToUTF16(kSearchText)); |
| 599 data.SetURL("http://abc.com/"); | 611 data.SetURL("http://abc.com/"); |
| 600 template_url_service->Add(new TemplateURL(data)); | 612 template_url_service->Add(new TemplateURL(data)); |
| 601 | 613 |
| 602 // Send "ab", so that an "abc" entry appears in the popup. | 614 // Send "ab", so that an "abc" entry appears in the popup. |
| 603 const wchar_t kSearchTextPrefixKeys[] = { ui::VKEY_A, ui::VKEY_B, 0 }; | 615 const ui::KeyboardCode kSearchTextPrefixKeys[] = { |
| 616 ui::VKEY_A, ui::VKEY_B, ui::VKEY_UNKNOWN | |
| 617 }; | |
| 604 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextPrefixKeys)); | 618 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextPrefixKeys)); |
| 605 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 619 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 606 ASSERT_TRUE(popup_model->IsOpen()); | 620 ASSERT_TRUE(popup_model->IsOpen()); |
| 607 | 621 |
| 608 // Arrow down to the "abc" entry in the popup. | 622 // Arrow down to the "abc" entry in the popup. |
| 609 size_t size = popup_model->result().size(); | 623 size_t size = popup_model->result().size(); |
| 610 while (popup_model->selected_line() < size - 1) { | 624 while (popup_model->selected_line() < size - 1) { |
| 611 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DOWN, 0)); | 625 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DOWN, 0)); |
| 612 if (omnibox_view->GetText() == ASCIIToUTF16("abc")) | 626 if (omnibox_view->GetText() == ASCIIToUTF16("abc")) |
| 613 break; | 627 break; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 // Open the default match. | 672 // Open the default match. |
| 659 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, 0, | 673 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, 0, |
| 660 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 674 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 661 content::Source<content::NavigationController>( | 675 content::Source<content::NavigationController>( |
| 662 &browser()->tab_strip_model()->GetActiveWebContents()-> | 676 &browser()->tab_strip_model()->GetActiveWebContents()-> |
| 663 GetController()))); | 677 GetController()))); |
| 664 GURL url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); | 678 GURL url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); |
| 665 EXPECT_EQ(kSearchTextURL, url.spec()); | 679 EXPECT_EQ(kSearchTextURL, url.spec()); |
| 666 | 680 |
| 667 // Test that entering a single character then Enter performs a search. | 681 // Test that entering a single character then Enter performs a search. |
| 668 const wchar_t kSearchSingleCharKeys[] = { ui::VKEY_Z, 0 }; | 682 const ui::KeyboardCode kSearchSingleCharKeys[] = { |
| 683 ui::VKEY_Z, ui::VKEY_UNKNOWN | |
| 684 }; | |
| 669 chrome::FocusLocationBar(browser()); | 685 chrome::FocusLocationBar(browser()); |
| 670 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 686 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
| 671 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchSingleCharKeys)); | 687 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchSingleCharKeys)); |
| 672 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 688 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 673 ASSERT_TRUE(popup_model->IsOpen()); | 689 ASSERT_TRUE(popup_model->IsOpen()); |
| 674 EXPECT_EQ("z", UTF16ToUTF8(omnibox_view->GetText())); | 690 EXPECT_EQ("z", UTF16ToUTF8(omnibox_view->GetText())); |
| 675 | 691 |
| 676 // Check if the default match result is Search Primary Provider. | 692 // Check if the default match result is Search Primary Provider. |
| 677 ASSERT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, | 693 ASSERT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, |
| 678 popup_model->result().default_match()->type); | 694 popup_model->result().default_match()->type); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 // Space should accept keyword even when inline autocomplete is available. | 938 // Space should accept keyword even when inline autocomplete is available. |
| 923 omnibox_view->SetUserText(base::string16()); | 939 omnibox_view->SetUserText(base::string16()); |
| 924 const TestHistoryEntry kHistoryFoobar = { | 940 const TestHistoryEntry kHistoryFoobar = { |
| 925 "http://www.foobar.com", "Page foobar", 100, 100, true | 941 "http://www.foobar.com", "Page foobar", 100, 100, true |
| 926 }; | 942 }; |
| 927 | 943 |
| 928 // Add a history entry to trigger inline autocomplete when typing "foo". | 944 // Add a history entry to trigger inline autocomplete when typing "foo". |
| 929 ASSERT_NO_FATAL_FAILURE( | 945 ASSERT_NO_FATAL_FAILURE( |
| 930 AddHistoryEntry(kHistoryFoobar, Time::Now() - TimeDelta::FromHours(1))); | 946 AddHistoryEntry(kHistoryFoobar, Time::Now() - TimeDelta::FromHours(1))); |
| 931 | 947 |
| 932 // Type "foo" to trigger inline autocomplete. | 948 // Type "fo" to trigger inline autocomplete. |
| 933 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); | 949 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordPrefixKeys)); |
| 934 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 950 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 935 ASSERT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); | 951 ASSERT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); |
| 936 ASSERT_NE(search_keyword, omnibox_view->GetText()); | 952 ASSERT_NE(search_keyword, omnibox_view->GetText()); |
| 937 | 953 |
| 938 // Keyword hint shouldn't be visible. | 954 // Keyword hint shouldn't be visible. |
| 939 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); | 955 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); |
| 940 ASSERT_TRUE(omnibox_view->model()->keyword().empty()); | 956 ASSERT_TRUE(omnibox_view->model()->keyword().empty()); |
| 941 | 957 |
| 958 // Add the "o". Inline autocompletion should still happen, but now we | |
| 959 // should also get a keyword hint because we've typed a keyword exactly. | |
| 960 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordCompletionKeys)); | |
| 961 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | |
| 962 ASSERT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); | |
| 963 ASSERT_NE(search_keyword, omnibox_view->GetText()); | |
| 964 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); | |
| 965 ASSERT_FALSE(omnibox_view->model()->keyword().empty()); | |
| 966 | |
| 942 // Trigger keyword mode by space. | 967 // Trigger keyword mode by space. |
| 943 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); | 968 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); |
| 944 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); | 969 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); |
| 945 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword()); | 970 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword()); |
| 946 ASSERT_TRUE(omnibox_view->GetText().empty()); | 971 ASSERT_TRUE(omnibox_view->GetText().empty()); |
| 947 | 972 |
| 948 // Space in the middle of a temporary text, which separates the text into | 973 // Space in the middle of a temporary text, which separates the text into |
| 949 // keyword and replacement portions, should trigger keyword mode. | 974 // keyword and replacement portions, should trigger keyword mode. |
| 950 omnibox_view->SetUserText(base::string16()); | 975 omnibox_view->SetUserText(base::string16()); |
| 951 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); | 976 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 #define MAYBE_TabTraverseResultsTest TabTraverseResultsTest | 1247 #define MAYBE_TabTraverseResultsTest TabTraverseResultsTest |
| 1223 #endif | 1248 #endif |
| 1224 | 1249 |
| 1225 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_TabTraverseResultsTest) { | 1250 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_TabTraverseResultsTest) { |
| 1226 OmniboxView* omnibox_view = NULL; | 1251 OmniboxView* omnibox_view = NULL; |
| 1227 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1252 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 1228 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 1253 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
| 1229 ASSERT_TRUE(popup_model); | 1254 ASSERT_TRUE(popup_model); |
| 1230 | 1255 |
| 1231 // Input something to trigger results. | 1256 // Input something to trigger results. |
| 1232 const wchar_t kKeys[] = { ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, 0 }; | 1257 const ui::KeyboardCode kKeys[] = { |
| 1258 ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, ui::VKEY_UNKNOWN | |
| 1259 }; | |
| 1233 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kKeys)); | 1260 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kKeys)); |
| 1234 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 1261 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 1235 ASSERT_TRUE(popup_model->IsOpen()); | 1262 ASSERT_TRUE(popup_model->IsOpen()); |
| 1236 | 1263 |
| 1237 size_t old_selected_line = popup_model->selected_line(); | 1264 size_t old_selected_line = popup_model->selected_line(); |
| 1238 EXPECT_EQ(0U, old_selected_line); | 1265 EXPECT_EQ(0U, old_selected_line); |
| 1239 | 1266 |
| 1240 // Move down the results. | 1267 // Move down the results. |
| 1241 for (size_t size = popup_model->result().size(); | 1268 for (size_t size = popup_model->result().size(); |
| 1242 popup_model->selected_line() < size - 1; | 1269 popup_model->selected_line() < size - 1; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1693 ASSERT_EQ(0U, end); | 1720 ASSERT_EQ(0U, end); |
| 1694 } | 1721 } |
| 1695 | 1722 |
| 1696 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CtrlArrowAfterArrowSuggestions) { | 1723 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CtrlArrowAfterArrowSuggestions) { |
| 1697 OmniboxView* omnibox_view = NULL; | 1724 OmniboxView* omnibox_view = NULL; |
| 1698 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1725 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 1699 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 1726 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
| 1700 ASSERT_TRUE(popup_model); | 1727 ASSERT_TRUE(popup_model); |
| 1701 | 1728 |
| 1702 // Input something to trigger results. | 1729 // Input something to trigger results. |
| 1703 const wchar_t kKeys[] = { ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, 0 }; | 1730 const ui::KeyboardCode kKeys[] = { |
| 1731 ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, ui::VKEY_UNKNOWN | |
| 1732 }; | |
| 1704 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kKeys)); | 1733 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kKeys)); |
| 1705 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 1734 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 1706 ASSERT_TRUE(popup_model->IsOpen()); | 1735 ASSERT_TRUE(popup_model->IsOpen()); |
| 1707 | 1736 |
| 1708 ASSERT_EQ(ASCIIToUTF16("bar.com/1"), omnibox_view->GetText()); | 1737 ASSERT_EQ(ASCIIToUTF16("bar.com/1"), omnibox_view->GetText()); |
| 1709 | 1738 |
| 1710 // Arrow down on a suggestion, and omnibox text should be the suggestion. | 1739 // Arrow down on a suggestion, and omnibox text should be the suggestion. |
| 1711 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DOWN, 0)); | 1740 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DOWN, 0)); |
| 1712 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 1741 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 1713 ASSERT_EQ(ASCIIToUTF16("www.bar.com/2"), omnibox_view->GetText()); | 1742 ASSERT_EQ(ASCIIToUTF16("www.bar.com/2"), omnibox_view->GetText()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1786 omnibox_view->Update(); | 1815 omnibox_view->Update(); |
| 1787 EXPECT_EQ(url_c, omnibox_view->GetText()); | 1816 EXPECT_EQ(url_c, omnibox_view->GetText()); |
| 1788 } | 1817 } |
| 1789 | 1818 |
| 1790 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { | 1819 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { |
| 1791 browser()->toolbar_model()->set_url_replacement_enabled(true); | 1820 browser()->toolbar_model()->set_url_replacement_enabled(true); |
| 1792 chrome::FocusLocationBar(browser()); | 1821 chrome::FocusLocationBar(browser()); |
| 1793 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); | 1822 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); |
| 1794 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); | 1823 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); |
| 1795 } | 1824 } |
| OLD | NEW |