OLD | NEW |
---|---|
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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // Check if RevertAll() can set text and cursor correctly. | 864 // Check if RevertAll() can set text and cursor correctly. |
865 omnibox_view->RevertAll(); | 865 omnibox_view->RevertAll(); |
866 EXPECT_FALSE(omnibox_view->IsSelectAll()); | 866 EXPECT_FALSE(omnibox_view->IsSelectAll()); |
867 EXPECT_EQ(old_text, omnibox_view->GetText()); | 867 EXPECT_EQ(old_text, omnibox_view->GetText()); |
868 omnibox_view->GetSelectionBounds(&start, &end); | 868 omnibox_view->GetSelectionBounds(&start, &end); |
869 EXPECT_EQ(old_text.size(), start); | 869 EXPECT_EQ(0U, start); |
870 EXPECT_EQ(old_text.size(), end); | 870 EXPECT_EQ(0U, end); |
Peter Kasting
2017/05/17 02:44:14
Maybe before RevertAll() we should explicitly move
Kevin Bailey
2017/05/17 03:57:52
ack, good suggestions.
Mark P
2017/05/22 23:58:48
I don't see a change after this comment. Did you
Kevin Bailey
2017/05/23 00:03:02
https://codereview.chromium.org/2891653003/
Mark P
2017/05/23 03:59:59
Awesome. I love follow-through. :-)
| |
871 } | 871 } |
872 | 872 |
873 // Make sure the cursor position doesn't get set past the last character of | 873 // Make sure the cursor position doesn't get set past the last character of |
874 // user input text when the URL is longer than the keyword. | 874 // user input text when the URL is longer than the keyword. |
875 // (http://crbug.com/656209) | 875 // (http://crbug.com/656209) |
876 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, FocusSearchLongUrl) { | 876 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, FocusSearchLongUrl) { |
877 OmniboxView* omnibox_view = NULL; | 877 OmniboxView* omnibox_view = NULL; |
878 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 878 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
879 | 879 |
880 ASSERT_GT(strlen(url::kAboutBlankURL), strlen(kSearchKeyword)); | 880 ASSERT_GT(strlen(url::kAboutBlankURL), strlen(kSearchKeyword)); |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 } |
OLD | NEW |