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

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

Issue 561983002: Make OmniboxViewTest.BasicTextOperations Work on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove extraneous swap 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 | no next file » | 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 735
736 EXPECT_NE(old_text, omnibox_view->GetText()); 736 EXPECT_NE(old_text, omnibox_view->GetText());
737 737
738 // Escape shall revert back to the default match item. 738 // Escape shall revert back to the default match item.
739 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); 739 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0));
740 EXPECT_EQ(old_text, omnibox_view->GetText()); 740 EXPECT_EQ(old_text, omnibox_view->GetText());
741 EXPECT_EQ(old_selected_line, popup_model->selected_line()); 741 EXPECT_EQ(old_selected_line, popup_model->selected_line());
742 } 742 }
743 743
744 // Flaky on Windows: http://crbug.com/146619 744 // Flaky on Windows: http://crbug.com/146619
745 // Fails on Linux: http://crbug.com/408637 745 #if defined(OS_WIN)
746 #if defined(OS_WIN) || defined(OS_LINUX)
747 #define MAYBE_BasicTextOperations DISABLED_BasicTextOperations 746 #define MAYBE_BasicTextOperations DISABLED_BasicTextOperations
748 #else 747 #else
749 #define MAYBE_BasicTextOperations BasicTextOperations 748 #define MAYBE_BasicTextOperations BasicTextOperations
750 #endif 749 #endif
751 750
752 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_BasicTextOperations) { 751 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_BasicTextOperations) {
753 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); 752 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
754 chrome::FocusLocationBar(browser()); 753 chrome::FocusLocationBar(browser());
755 754
756 OmniboxView* omnibox_view = NULL; 755 OmniboxView* omnibox_view = NULL;
757 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 756 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
758 757
759 base::string16 old_text = omnibox_view->GetText(); 758 base::string16 old_text = omnibox_view->GetText();
760 EXPECT_EQ(base::UTF8ToUTF16(url::kAboutBlankURL), old_text); 759 EXPECT_EQ(base::UTF8ToUTF16(url::kAboutBlankURL), old_text);
761 EXPECT_TRUE(omnibox_view->IsSelectAll()); 760 EXPECT_TRUE(omnibox_view->IsSelectAll());
762 761
763 size_t start, end; 762 size_t start, end;
764 omnibox_view->GetSelectionBounds(&start, &end); 763 omnibox_view->GetSelectionBounds(&start, &end);
764 #if defined(OS_WIN) || defined(OS_LINUX)
765 // Views textfields select-all in reverse to show the leading text.
766 std::swap(start, end);
767 #endif
765 EXPECT_EQ(0U, start); 768 EXPECT_EQ(0U, start);
766 EXPECT_EQ(old_text.size(), end); 769 EXPECT_EQ(old_text.size(), end);
767 770
768 // Move the cursor to the end. 771 // Move the cursor to the end.
769 #if defined(OS_MACOSX) 772 #if defined(OS_MACOSX)
770 // End doesn't work on Mac trybot. 773 // End doesn't work on Mac trybot.
771 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_E, ui::EF_CONTROL_DOWN)); 774 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_E, ui::EF_CONTROL_DOWN));
772 #else 775 #else
773 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0)); 776 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0));
774 #endif 777 #endif
(...skipping 10 matching lines...) Expand all
785 EXPECT_EQ(old_text + base::char16('a'), omnibox_view->GetText()); 788 EXPECT_EQ(old_text + base::char16('a'), omnibox_view->GetText());
786 789
787 // Delete one character from the end. Make sure we won't delete the special 790 // Delete one character from the end. Make sure we won't delete the special
788 // ZWS mark used in gtk implementation. 791 // ZWS mark used in gtk implementation.
789 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); 792 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0));
790 EXPECT_EQ(old_text, omnibox_view->GetText()); 793 EXPECT_EQ(old_text, omnibox_view->GetText());
791 794
792 omnibox_view->SelectAll(true); 795 omnibox_view->SelectAll(true);
793 EXPECT_TRUE(omnibox_view->IsSelectAll()); 796 EXPECT_TRUE(omnibox_view->IsSelectAll());
794 omnibox_view->GetSelectionBounds(&start, &end); 797 omnibox_view->GetSelectionBounds(&start, &end);
798 #if defined(OS_WIN) || defined(OS_LINUX)
799 // Views textfields select-all in reverse to show the leading text.
800 std::swap(start, end);
801 #endif
795 EXPECT_EQ(0U, start); 802 EXPECT_EQ(0U, start);
796 EXPECT_EQ(old_text.size(), end); 803 EXPECT_EQ(old_text.size(), end);
797 804
798 // Delete the content 805 // Delete the content
799 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DELETE, 0)); 806 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DELETE, 0));
800 EXPECT_TRUE(omnibox_view->IsSelectAll()); 807 EXPECT_TRUE(omnibox_view->IsSelectAll());
801 omnibox_view->GetSelectionBounds(&start, &end); 808 omnibox_view->GetSelectionBounds(&start, &end);
802 EXPECT_EQ(0U, start); 809 EXPECT_EQ(0U, start);
803 EXPECT_EQ(0U, end); 810 EXPECT_EQ(0U, end);
804 EXPECT_TRUE(omnibox_view->GetText().empty()); 811 EXPECT_TRUE(omnibox_view->GetText().empty());
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 omnibox_view->Update(); 1806 omnibox_view->Update();
1800 EXPECT_EQ(url_c, omnibox_view->GetText()); 1807 EXPECT_EQ(url_c, omnibox_view->GetText());
1801 } 1808 }
1802 1809
1803 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { 1810 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) {
1804 browser()->toolbar_model()->set_url_replacement_enabled(true); 1811 browser()->toolbar_model()->set_url_replacement_enabled(true);
1805 chrome::FocusLocationBar(browser()); 1812 chrome::FocusLocationBar(browser());
1806 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); 1813 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0));
1807 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); 1814 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled());
1808 } 1815 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698