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

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

Issue 6268005: Removes the link in the omnibox for searching history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 9 years, 11 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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // Check if the default match result is Search Primary Provider. 570 // Check if the default match result is Search Primary Provider.
571 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, 571 ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED,
572 popup_model->result().default_match()->type); 572 popup_model->result().default_match()->type);
573 573
574 // Open the default match. 574 // Open the default match.
575 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, false, false, false)); 575 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, false, false, false));
576 url = browser()->GetSelectedTabContents()->GetURL(); 576 url = browser()->GetSelectedTabContents()->GetURL();
577 EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str()); 577 EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str());
578 } 578 }
579 579
580 // See http://crbug.com/20934: Omnibox keyboard behavior wrong for
581 // "See recent pages in history"
582 IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToOpenHistoryPage) {
583 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
584
585 ASSERT_NO_FATAL_FAILURE(SetupComponents());
586 browser()->FocusLocationBar();
587
588 AutocompleteEditView* edit_view = NULL;
589 ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view));
590 AutocompletePopupModel* popup_model = edit_view->model()->popup_model();
591 ASSERT_TRUE(popup_model);
592
593 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys));
594 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
595 ASSERT_TRUE(popup_model->IsOpen());
596 EXPECT_EQ(0U, popup_model->selected_line());
597
598 // Move to the history page item.
599 size_t size = popup_model->result().size();
600 while (true) {
601 if (popup_model->result().match_at(popup_model->selected_line()).type ==
602 AutocompleteMatch::OPEN_HISTORY_PAGE)
603 break;
604 size_t old_selected_line = popup_model->selected_line();
605 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DOWN, false, false, false));
606 ASSERT_EQ(old_selected_line + 1, popup_model->selected_line());
607 if (popup_model->selected_line() == size - 1)
608 break;
609 }
610
611 // Make sure the history page item is selected.
612 ASSERT_EQ(AutocompleteMatch::OPEN_HISTORY_PAGE,
613 popup_model->result().match_at(popup_model->selected_line()).type);
614
615 // Open the history page item.
616 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, false, false, false));
617 GURL url = browser()->GetSelectedTabContents()->GetURL();
618 EXPECT_STREQ(kHistoryPageURL, url.spec().c_str());
619 }
620
621 IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EscapeToDefaultMatch) { 580 IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EscapeToDefaultMatch) {
622 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 581 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
623 582
624 ASSERT_NO_FATAL_FAILURE(SetupComponents()); 583 ASSERT_NO_FATAL_FAILURE(SetupComponents());
625 browser()->FocusLocationBar(); 584 browser()->FocusLocationBar();
626 585
627 AutocompleteEditView* edit_view = NULL; 586 AutocompleteEditView* edit_view = NULL;
628 ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); 587 ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view));
629 AutocompletePopupModel* popup_model = edit_view->model()->popup_model(); 588 AutocompletePopupModel* popup_model = edit_view->model()->popup_model();
630 ASSERT_TRUE(popup_model); 589 ASSERT_TRUE(popup_model);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 809
851 // Paste text. 810 // Paste text.
852 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, true, false, false)); 811 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, true, false, false));
853 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 812 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
854 ASSERT_TRUE(popup_model->IsOpen()); 813 ASSERT_TRUE(popup_model->IsOpen());
855 814
856 // Inline autocomplete shouldn't be triggered. 815 // Inline autocomplete shouldn't be triggered.
857 ASSERT_EQ(L"abc", edit_view->GetText()); 816 ASSERT_EQ(L"abc", edit_view->GetText());
858 } 817 }
859 #endif 818 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698