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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc

Issue 517683002: Re-Enable Most OmniboxViewTests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 #if !defined(OS_CHROMEOS) && !defined(OS_MACOSX) 415 #if !defined(OS_CHROMEOS) && !defined(OS_MACOSX)
416 // Try alt-f4 to close the browser. 416 // Try alt-f4 to close the browser.
417 ASSERT_TRUE(SendKeyAndWait( 417 ASSERT_TRUE(SendKeyAndWait(
418 browser(), ui::VKEY_F4, ui::EF_ALT_DOWN, 418 browser(), ui::VKEY_F4, ui::EF_ALT_DOWN,
419 chrome::NOTIFICATION_BROWSER_CLOSED, 419 chrome::NOTIFICATION_BROWSER_CLOSED,
420 content::Source<Browser>(browser()))); 420 content::Source<Browser>(browser())));
421 #endif 421 #endif
422 } 422 }
423 423
424 // Flakily fails and times out on Win only. http://crbug.com/69941 424 // Flakily fails and times out on Win only. http://crbug.com/69941
425 #if defined(OS_WIN) 425 // Fails on Linux. http://crbug.com/408634
426 #if defined(OS_WIN) || defined(OS_LINUX)
426 #define MAYBE_PopupAccelerators DISABLED_PopupAccelerators 427 #define MAYBE_PopupAccelerators DISABLED_PopupAccelerators
427 #else 428 #else
428 #define MAYBE_PopupAccelerators PopupAccelerators 429 #define MAYBE_PopupAccelerators PopupAccelerators
429 #endif 430 #endif
430 431
431 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_PopupAccelerators) { 432 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_PopupAccelerators) {
432 // Create a popup. 433 // Create a popup.
433 Browser* popup = CreateBrowserForPopup(browser()->profile()); 434 Browser* popup = CreateBrowserForPopup(browser()->profile());
434 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(popup)); 435 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(popup));
435 OmniboxView* omnibox_view = NULL; 436 OmniboxView* omnibox_view = NULL;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 ASSERT_EQ(std::string(kSearchKeyword) + kSearchText, 538 ASSERT_EQ(std::string(kSearchKeyword) + kSearchText,
538 UTF16ToUTF8(omnibox_view->GetText())); 539 UTF16ToUTF8(omnibox_view->GetText()));
539 } 540 }
540 541
541 // http://crbug.com/158913 542 // http://crbug.com/158913
542 #if defined(OS_CHROMEOS) || defined(OS_WIN) 543 #if defined(OS_CHROMEOS) || defined(OS_WIN)
543 #define MAYBE_Escape DISABLED_Escape 544 #define MAYBE_Escape DISABLED_Escape
544 #else 545 #else
545 #define MAYBE_Escape Escape 546 #define MAYBE_Escape Escape
546 #endif 547 #endif
548
547 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_Escape) { 549 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_Escape) {
548 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL)); 550 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL));
549 chrome::FocusLocationBar(browser()); 551 chrome::FocusLocationBar(browser());
550 552
551 OmniboxView* omnibox_view = NULL; 553 OmniboxView* omnibox_view = NULL;
552 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 554 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
553 555
554 base::string16 old_text = omnibox_view->GetText(); 556 base::string16 old_text = omnibox_view->GetText();
555 EXPECT_FALSE(old_text.empty()); 557 EXPECT_FALSE(old_text.empty());
556 EXPECT_TRUE(omnibox_view->IsSelectAll()); 558 EXPECT_TRUE(omnibox_view->IsSelectAll());
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 // Open the default match. 698 // Open the default match.
697 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, 0, 699 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, 0,
698 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 700 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
699 content::Source<content::NavigationController>( 701 content::Source<content::NavigationController>(
700 &browser()->tab_strip_model()->GetActiveWebContents()-> 702 &browser()->tab_strip_model()->GetActiveWebContents()->
701 GetController()))); 703 GetController())));
702 url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); 704 url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL();
703 EXPECT_EQ("http://www.foo.com/search?q=z", url.spec()); 705 EXPECT_EQ("http://www.foo.com/search?q=z", url.spec());
704 } 706 }
705 707
706 // http://crbug.com/131179 708 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscapeToDefaultMatch) {
707 #if defined(OS_LINUX)
708 #define MAYBE_EscapeToDefaultMatch DISABLED_EscapeToDefaultMatch
709 #else
710 #define MAYBE_EscapeToDefaultMatch EscapeToDefaultMatch
711 #endif
712 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_EscapeToDefaultMatch) {
713 OmniboxView* omnibox_view = NULL; 709 OmniboxView* omnibox_view = NULL;
714 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 710 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
715 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); 711 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model();
716 ASSERT_TRUE(popup_model); 712 ASSERT_TRUE(popup_model);
717 713
718 // Input something to trigger inline autocomplete. 714 // Input something to trigger inline autocomplete.
719 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kInlineAutocompleteTextKeys)); 715 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kInlineAutocompleteTextKeys));
720 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 716 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
721 ASSERT_TRUE(popup_model->IsOpen()); 717 ASSERT_TRUE(popup_model->IsOpen());
722 718
(...skipping 15 matching lines...) Expand all
738 } 734 }
739 735
740 EXPECT_NE(old_text, omnibox_view->GetText()); 736 EXPECT_NE(old_text, omnibox_view->GetText());
741 737
742 // Escape shall revert back to the default match item. 738 // Escape shall revert back to the default match item.
743 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); 739 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0));
744 EXPECT_EQ(old_text, omnibox_view->GetText()); 740 EXPECT_EQ(old_text, omnibox_view->GetText());
745 EXPECT_EQ(old_selected_line, popup_model->selected_line()); 741 EXPECT_EQ(old_selected_line, popup_model->selected_line());
746 } 742 }
747 743
748 // http://crbug.com/131179, http://crbug.com/146619 744 // Flaky on Windows: http://crbug.com/146619
749 #if defined(OS_LINUX) || defined(OS_WIN) 745 // Fails on Linux: http://crbug.com/408637
746 #if defined(OS_WIN) || defined(OS_LINUX)
750 #define MAYBE_BasicTextOperations DISABLED_BasicTextOperations 747 #define MAYBE_BasicTextOperations DISABLED_BasicTextOperations
751 #else 748 #else
752 #define MAYBE_BasicTextOperations BasicTextOperations 749 #define MAYBE_BasicTextOperations BasicTextOperations
753 #endif 750 #endif
751
754 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_BasicTextOperations) { 752 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_BasicTextOperations) {
755 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); 753 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
756 chrome::FocusLocationBar(browser()); 754 chrome::FocusLocationBar(browser());
757 755
758 OmniboxView* omnibox_view = NULL; 756 OmniboxView* omnibox_view = NULL;
759 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 757 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
760 758
761 base::string16 old_text = omnibox_view->GetText(); 759 base::string16 old_text = omnibox_view->GetText();
762 EXPECT_EQ(base::UTF8ToUTF16(url::kAboutBlankURL), old_text); 760 EXPECT_EQ(base::UTF8ToUTF16(url::kAboutBlankURL), old_text);
763 EXPECT_TRUE(omnibox_view->IsSelectAll()); 761 EXPECT_TRUE(omnibox_view->IsSelectAll());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 805
808 // Check if RevertAll() can set text and cursor correctly. 806 // Check if RevertAll() can set text and cursor correctly.
809 omnibox_view->RevertAll(); 807 omnibox_view->RevertAll();
810 EXPECT_FALSE(omnibox_view->IsSelectAll()); 808 EXPECT_FALSE(omnibox_view->IsSelectAll());
811 EXPECT_EQ(old_text, omnibox_view->GetText()); 809 EXPECT_EQ(old_text, omnibox_view->GetText());
812 omnibox_view->GetSelectionBounds(&start, &end); 810 omnibox_view->GetSelectionBounds(&start, &end);
813 EXPECT_EQ(old_text.size(), start); 811 EXPECT_EQ(old_text.size(), start);
814 EXPECT_EQ(old_text.size(), end); 812 EXPECT_EQ(old_text.size(), end);
815 } 813 }
816 814
817 // http://crbug.com/131179 815 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AcceptKeywordBySpace) {
818 #if defined(OS_LINUX)
819 #define MAYBE_AcceptKeywordBySpace DISABLED_AcceptKeywordBySpace
820 #else
821 #define MAYBE_AcceptKeywordBySpace AcceptKeywordBySpace
822 #endif
823
824 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_AcceptKeywordBySpace) {
825 OmniboxView* omnibox_view = NULL; 816 OmniboxView* omnibox_view = NULL;
826 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 817 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
827 818
828 base::string16 search_keyword(ASCIIToUTF16(kSearchKeyword)); 819 base::string16 search_keyword(ASCIIToUTF16(kSearchKeyword));
829 820
830 // Trigger keyword hint mode. 821 // Trigger keyword hint mode.
831 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); 822 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys));
832 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); 823 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint());
833 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword()); 824 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword());
834 ASSERT_EQ(search_keyword, omnibox_view->GetText()); 825 ASSERT_EQ(search_keyword, omnibox_view->GetText());
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 while ((omnibox_view->GetText() != search_keyword2) && 1006 while ((omnibox_view->GetText() != search_keyword2) &&
1016 (popup_model->selected_line() < popup_model->result().size() - 1)) 1007 (popup_model->selected_line() < popup_model->result().size() - 1))
1017 omnibox_view->model()->OnUpOrDownKeyPressed(1); 1008 omnibox_view->model()->OnUpOrDownKeyPressed(1);
1018 ASSERT_EQ(search_keyword2, omnibox_view->GetText()); 1009 ASSERT_EQ(search_keyword2, omnibox_view->GetText());
1019 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); 1010 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0));
1020 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); 1011 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint());
1021 ASSERT_EQ(search_keyword2, omnibox_view->model()->keyword()); 1012 ASSERT_EQ(search_keyword2, omnibox_view->model()->keyword());
1022 ASSERT_TRUE(omnibox_view->GetText().empty()); 1013 ASSERT_TRUE(omnibox_view->GetText().empty());
1023 } 1014 }
1024 1015
1025 // http://crbug.com/131179 1016 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, NonSubstitutingKeywordTest) {
1026 #if defined(OS_LINUX)
1027 #define MAYBE_NonSubstitutingKeywordTest DISABLED_NonSubstitutingKeywordTest
1028 #else
1029 #define MAYBE_NonSubstitutingKeywordTest NonSubstitutingKeywordTest
1030 #endif
1031
1032 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_NonSubstitutingKeywordTest) {
1033 OmniboxView* omnibox_view = NULL; 1017 OmniboxView* omnibox_view = NULL;
1034 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 1018 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
1035 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); 1019 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model();
1036 ASSERT_TRUE(popup_model); 1020 ASSERT_TRUE(popup_model);
1037 1021
1038 Profile* profile = browser()->profile(); 1022 Profile* profile = browser()->profile();
1039 TemplateURLService* template_url_service = 1023 TemplateURLService* template_url_service =
1040 TemplateURLServiceFactory::GetForProfile(profile); 1024 TemplateURLServiceFactory::GetForProfile(profile);
1041 1025
1042 // Add a non-default substituting keyword. 1026 // Add a non-default substituting keyword.
(...skipping 30 matching lines...) Expand all
1073 // We always allow exact matches for non-substituting keywords. 1057 // We always allow exact matches for non-substituting keywords.
1074 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys)); 1058 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys));
1075 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 1059 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
1076 ASSERT_TRUE(popup_model->IsOpen()); 1060 ASSERT_TRUE(popup_model->IsOpen());
1077 ASSERT_EQ(AutocompleteMatchType::HISTORY_KEYWORD, 1061 ASSERT_EQ(AutocompleteMatchType::HISTORY_KEYWORD,
1078 popup_model->result().default_match()->type); 1062 popup_model->result().default_match()->type);
1079 ASSERT_EQ("http://abc.com/", 1063 ASSERT_EQ("http://abc.com/",
1080 popup_model->result().default_match()->destination_url.spec()); 1064 popup_model->result().default_match()->destination_url.spec());
1081 } 1065 }
1082 1066
1083 // http://crbug.com/131179 http://crbug.com/165765 1067 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DeleteItem) {
1084 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_MACOSX)
1085 #define MAYBE_DeleteItem DISABLED_DeleteItem
1086 #else
1087 #define MAYBE_DeleteItem DeleteItem
1088 #endif
1089 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_DeleteItem) {
1090 // Disable the search provider, to make sure the popup contains only history 1068 // Disable the search provider, to make sure the popup contains only history
1091 // items. 1069 // items.
1092 TemplateURLService* model = 1070 TemplateURLService* model =
1093 TemplateURLServiceFactory::GetForProfile(browser()->profile()); 1071 TemplateURLServiceFactory::GetForProfile(browser()->profile());
1094 model->SetUserSelectedDefaultSearchProvider(NULL); 1072 model->SetUserSelectedDefaultSearchProvider(NULL);
1095 1073
1096 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); 1074 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
1097 chrome::FocusLocationBar(browser()); 1075 chrome::FocusLocationBar(browser());
1098 1076
1099 OmniboxView* omnibox_view = NULL; 1077 OmniboxView* omnibox_view = NULL;
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 omnibox_view->Update(); 1799 omnibox_view->Update();
1822 EXPECT_EQ(url_c, omnibox_view->GetText()); 1800 EXPECT_EQ(url_c, omnibox_view->GetText());
1823 } 1801 }
1824 1802
1825 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { 1803 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) {
1826 browser()->toolbar_model()->set_url_replacement_enabled(true); 1804 browser()->toolbar_model()->set_url_replacement_enabled(true);
1827 chrome::FocusLocationBar(browser()); 1805 chrome::FocusLocationBar(browser());
1828 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); 1806 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0));
1829 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); 1807 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled());
1830 } 1808 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698