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

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

Issue 2942013002: [omnibox] Constrain 'IsSelectAll()' to be more accurate (Closed)
Patch Set: Missed a fix Created 3 years, 6 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 omnibox_view->GetSelectionBounds(&start, &end); 848 omnibox_view->GetSelectionBounds(&start, &end);
849 #if defined(OS_WIN) || defined(OS_LINUX) 849 #if defined(OS_WIN) || defined(OS_LINUX)
850 // Views textfields select-all in reverse to show the leading text. 850 // Views textfields select-all in reverse to show the leading text.
851 std::swap(start, end); 851 std::swap(start, end);
852 #endif 852 #endif
853 EXPECT_EQ(0U, start); 853 EXPECT_EQ(0U, start);
854 EXPECT_EQ(old_text.size(), end); 854 EXPECT_EQ(old_text.size(), end);
855 855
856 // Delete the content 856 // Delete the content
857 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DELETE, 0)); 857 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DELETE, 0));
858 EXPECT_TRUE(omnibox_view->IsSelectAll()); 858 EXPECT_FALSE(omnibox_view->IsSelectAll());
859 omnibox_view->GetSelectionBounds(&start, &end); 859 omnibox_view->GetSelectionBounds(&start, &end);
860 EXPECT_EQ(0U, start); 860 EXPECT_EQ(0U, start);
861 EXPECT_EQ(0U, end); 861 EXPECT_EQ(0U, end);
862 EXPECT_TRUE(omnibox_view->GetText().empty()); 862 EXPECT_TRUE(omnibox_view->GetText().empty());
863 863
864 // Add a small amount of text to move the cursor past offset 0. 864 // Add a small amount of text to move the cursor past offset 0.
865 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); 865 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0));
866 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_B, 0)); 866 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_B, 0));
867 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_C, 0)); 867 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_C, 0));
868 868
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 1999
2000 // Now Shift+Right should do nothing, and Shift+Left should reduce. 2000 // Now Shift+Right should do nothing, and Shift+Left should reduce.
2001 // At the end, so Shift+Right should do nothing. 2001 // At the end, so Shift+Right should do nothing.
2002 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, ui::EF_SHIFT_DOWN)); 2002 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, ui::EF_SHIFT_DOWN));
2003 EXPECT_EQ(2u, GetSelectionSize(omnibox_view)); 2003 EXPECT_EQ(2u, GetSelectionSize(omnibox_view));
2004 2004
2005 // And Left should reduce by one character. 2005 // And Left should reduce by one character.
2006 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN)); 2006 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN));
2007 EXPECT_EQ(1u, GetSelectionSize(omnibox_view)); 2007 EXPECT_EQ(1u, GetSelectionSize(omnibox_view));
2008 } 2008 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698