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

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

Issue 10820022: Disable SelectAllOnClick to unbreak tree. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« 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/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 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 1606 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
1607 ASSERT_TRUE(popup_model->IsOpen()); 1607 ASSERT_TRUE(popup_model->IsOpen());
1608 1608
1609 // Inline autocomplete shouldn't be triggered. 1609 // Inline autocomplete shouldn't be triggered.
1610 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText()); 1610 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText());
1611 } 1611 }
1612 #endif // defined(TOOLKIT_GTK) 1612 #endif // defined(TOOLKIT_GTK)
1613 1613
1614 // TODO(derat): Enable on Windows: http://crbug.com/128556 1614 // TODO(derat): Enable on Windows: http://crbug.com/128556
1615 #if defined(USE_AURA) 1615 #if defined(USE_AURA)
1616 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, SelectAllOnClick) { 1616 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DISABLED_SelectAllOnClick) {
1617 OmniboxView* omnibox_view = NULL; 1617 OmniboxView* omnibox_view = NULL;
1618 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 1618 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
1619 omnibox_view->SetUserText(ASCIIToUTF16("http://www.google.com/")); 1619 omnibox_view->SetUserText(ASCIIToUTF16("http://www.google.com/"));
1620 const gfx::Point kClickOffset(2, 2); 1620 const gfx::Point kClickOffset(2, 2);
1621 1621
1622 // Take the focus away from the omnibox. 1622 // Take the focus away from the omnibox.
1623 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter()); 1623 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter());
1624 EXPECT_FALSE(omnibox_view->IsSelectAll()); 1624 EXPECT_FALSE(omnibox_view->IsSelectAll());
1625 EXPECT_FALSE(GetFocusView()->HasFocus()); 1625 EXPECT_FALSE(GetFocusView()->HasFocus());
1626 1626
1627 // Click in the omnibox. All of its text should be selected. 1627 // Click in the omnibox. All of its text should be selected.
1628 ASSERT_NO_FATAL_FAILURE( 1628 ASSERT_NO_FATAL_FAILURE(
1629 ClickFocusViewOrigin(ui_controls::LEFT, kClickOffset, kClickOffset)); 1629 ClickFocusViewOrigin(ui_controls::LEFT, kClickOffset, kClickOffset));
1630 EXPECT_TRUE(omnibox_view->IsSelectAll()); 1630 EXPECT_TRUE(omnibox_view->IsSelectAll());
1631 EXPECT_TRUE(GetFocusView()->HasFocus()); 1631 EXPECT_TRUE(GetFocusView()->HasFocus());
1632 1632
1633 // Ensure that all of the text is selected and then take the focus away. The 1633 // Ensure that all of the text is selected and then take the focus away. The
1634 // selection should persist. 1634 // selection should persist.
1635 omnibox_view->SelectAll(false); 1635 omnibox_view->SelectAll(false);
1636 EXPECT_TRUE(omnibox_view->IsSelectAll()); 1636 EXPECT_TRUE(omnibox_view->IsSelectAll());
1637 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter()); 1637 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter());
1638 EXPECT_TRUE(omnibox_view->IsSelectAll()); 1638 EXPECT_TRUE(omnibox_view->IsSelectAll());
1639 EXPECT_FALSE(GetFocusView()->HasFocus()); 1639 EXPECT_FALSE(GetFocusView()->HasFocus());
1640 1640
1641 // Clicking in the omnibox while some of its text is already selected should 1641 // Clicking in the omnibox while some of its text is already selected should
1642 // have the effect of re-selecting the text. 1642 // have the effect of re-selecting the text.
1643 ASSERT_NO_FATAL_FAILURE( 1643 ASSERT_NO_FATAL_FAILURE(
1644 ClickFocusViewOrigin(ui_controls::LEFT, kClickOffset, kClickOffset)); 1644 ClickFocusViewOrigin(ui_controls::LEFT, kClickOffset, kClickOffset));
1645 // The following expect fails starting with one of the cls (148415-148428),
1646 // most likely the WebKit roll @148419.
1647 // http://crbug.com/139069
1645 EXPECT_TRUE(omnibox_view->IsSelectAll()); 1648 EXPECT_TRUE(omnibox_view->IsSelectAll());
1646 EXPECT_TRUE(GetFocusView()->HasFocus()); 1649 EXPECT_TRUE(GetFocusView()->HasFocus());
1647 1650
1648 // Click in a different spot in the omnibox. It should keep the focus but 1651 // Click in a different spot in the omnibox. It should keep the focus but
1649 // lose the selection. 1652 // lose the selection.
1650 omnibox_view->SelectAll(false); 1653 omnibox_view->SelectAll(false);
1651 const gfx::Point kSecondClickOffset(kClickOffset.x() + 10, kClickOffset.y()); 1654 const gfx::Point kSecondClickOffset(kClickOffset.x() + 10, kClickOffset.y());
1652 ASSERT_NO_FATAL_FAILURE( 1655 ASSERT_NO_FATAL_FAILURE(
1653 ClickFocusViewOrigin( 1656 ClickFocusViewOrigin(
1654 ui_controls::LEFT, kSecondClickOffset, kSecondClickOffset)); 1657 ui_controls::LEFT, kSecondClickOffset, kSecondClickOffset));
(...skipping 11 matching lines...) Expand all
1666 1669
1667 // Middle-clicking shouldn't select all the text either. 1670 // Middle-clicking shouldn't select all the text either.
1668 ASSERT_NO_FATAL_FAILURE( 1671 ASSERT_NO_FATAL_FAILURE(
1669 ClickFocusViewOrigin(ui_controls::LEFT, kClickOffset, kClickOffset)); 1672 ClickFocusViewOrigin(ui_controls::LEFT, kClickOffset, kClickOffset));
1670 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter()); 1673 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter());
1671 ASSERT_NO_FATAL_FAILURE( 1674 ASSERT_NO_FATAL_FAILURE(
1672 ClickFocusViewOrigin(ui_controls::MIDDLE, kClickOffset, kClickOffset)); 1675 ClickFocusViewOrigin(ui_controls::MIDDLE, kClickOffset, kClickOffset));
1673 EXPECT_FALSE(omnibox_view->IsSelectAll()); 1676 EXPECT_FALSE(omnibox_view->IsSelectAll());
1674 } 1677 }
1675 #endif // defined(USE_AURA) 1678 #endif // defined(USE_AURA)
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