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

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

Issue 2425703003: Fix failing DCHECK in AutoCompleteInput() (Closed)
Patch Set: use pkasting's suggested code Created 4 years, 2 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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 862
863 // Check if RevertAll() can set text and cursor correctly. 863 // Check if RevertAll() can set text and cursor correctly.
864 omnibox_view->RevertAll(); 864 omnibox_view->RevertAll();
865 EXPECT_FALSE(omnibox_view->IsSelectAll()); 865 EXPECT_FALSE(omnibox_view->IsSelectAll());
866 EXPECT_EQ(old_text, omnibox_view->GetText()); 866 EXPECT_EQ(old_text, omnibox_view->GetText());
867 omnibox_view->GetSelectionBounds(&start, &end); 867 omnibox_view->GetSelectionBounds(&start, &end);
868 EXPECT_EQ(old_text.size(), start); 868 EXPECT_EQ(old_text.size(), start);
869 EXPECT_EQ(old_text.size(), end); 869 EXPECT_EQ(old_text.size(), end);
870 } 870 }
871 871
872 // Make sure the cursor position doesn't get set past the last character of
873 // user input text when the URL is longer than the keyword.
874 // (http://crbug.com/656209)
875 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, FocusSearchLongUrl) {
876 OmniboxView* omnibox_view = NULL;
877 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
878
879 ASSERT_GT(strlen(url::kAboutBlankURL), strlen(kSearchKeyword));
880 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
881
882 // Make sure nothing DCHECKs.
883 chrome::FocusSearch(browser());
884 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
885 }
886
872 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AcceptKeywordByTypingQuestionMark) { 887 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AcceptKeywordByTypingQuestionMark) {
873 OmniboxView* omnibox_view = NULL; 888 OmniboxView* omnibox_view = NULL;
874 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 889 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
875 890
876 base::string16 search_keyword(ASCIIToUTF16(kSearchKeyword)); 891 base::string16 search_keyword(ASCIIToUTF16(kSearchKeyword));
877 892
878 // If the user gets into keyword mode by typing '?', they should be put into 893 // If the user gets into keyword mode by typing '?', they should be put into
879 // keyword mode for their default search provider. 894 // keyword mode for their default search provider.
880 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_OEM_2, ui::EF_SHIFT_DOWN)); 895 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_OEM_2, ui::EF_SHIFT_DOWN));
881 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); 896 ASSERT_FALSE(omnibox_view->model()->is_keyword_hint());
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 1942
1928 // Now Shift+Right should do nothing, and Shift+Left should reduce. 1943 // Now Shift+Right should do nothing, and Shift+Left should reduce.
1929 // At the end, so Shift+Right should do nothing. 1944 // At the end, so Shift+Right should do nothing.
1930 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, ui::EF_SHIFT_DOWN)); 1945 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, ui::EF_SHIFT_DOWN));
1931 EXPECT_EQ(2u, GetSelectionSize(omnibox_view)); 1946 EXPECT_EQ(2u, GetSelectionSize(omnibox_view));
1932 1947
1933 // And Left should reduce by one character. 1948 // And Left should reduce by one character.
1934 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN)); 1949 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN));
1935 EXPECT_EQ(1u, GetSelectionSize(omnibox_view)); 1950 EXPECT_EQ(1u, GetSelectionSize(omnibox_view));
1936 } 1951 }
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