| 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 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 OmniboxView* omnibox_view = NULL; | 1858 OmniboxView* omnibox_view = NULL; |
| 1859 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1859 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 1860 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_EDIT_SEARCH_ENGINES)); | 1860 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_EDIT_SEARCH_ENGINES)); |
| 1861 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 1861 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 1862 const std::string target_url = | 1862 const std::string target_url = |
| 1863 std::string(chrome::kChromeUISettingsURL) + chrome::kSearchEnginesSubPage; | 1863 std::string(chrome::kChromeUISettingsURL) + chrome::kSearchEnginesSubPage; |
| 1864 EXPECT_EQ(ASCIIToUTF16(target_url), omnibox_view->GetText()); | 1864 EXPECT_EQ(ASCIIToUTF16(target_url), omnibox_view->GetText()); |
| 1865 EXPECT_FALSE(omnibox_view->model()->popup_model()->IsOpen()); | 1865 EXPECT_FALSE(omnibox_view->model()->popup_model()->IsOpen()); |
| 1866 } | 1866 } |
| 1867 | 1867 |
| 1868 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BeginningShownAfterBlur) { | |
| 1869 OmniboxView* omnibox_view = NULL; | |
| 1870 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | |
| 1871 | |
| 1872 omnibox_view->OnBeforePossibleChange(); | |
| 1873 omnibox_view->SetWindowTextAndCaretPos(ASCIIToUTF16("data:text/plain,test"), | |
| 1874 5U, false, false); | |
| 1875 omnibox_view->OnAfterPossibleChange(true); | |
| 1876 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | |
| 1877 size_t start, end; | |
| 1878 omnibox_view->GetSelectionBounds(&start, &end); | |
| 1879 EXPECT_EQ(5U, start); | |
| 1880 EXPECT_EQ(5U, end); | |
| 1881 | |
| 1882 ui_test_utils::FocusView(browser(), VIEW_ID_TAB_CONTAINER); | |
| 1883 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | |
| 1884 | |
| 1885 omnibox_view->GetSelectionBounds(&start, &end); | |
| 1886 EXPECT_EQ(0U, start); | |
| 1887 EXPECT_EQ(0U, end); | |
| 1888 } | |
| 1889 | |
| 1890 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CtrlArrowAfterArrowSuggestions) { | 1868 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CtrlArrowAfterArrowSuggestions) { |
| 1891 OmniboxView* omnibox_view = NULL; | 1869 OmniboxView* omnibox_view = NULL; |
| 1892 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1870 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 1893 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 1871 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
| 1894 ASSERT_TRUE(popup_model); | 1872 ASSERT_TRUE(popup_model); |
| 1895 | 1873 |
| 1896 // Input something to trigger results. | 1874 // Input something to trigger results. |
| 1897 const ui::KeyboardCode kKeys[] = { | 1875 const ui::KeyboardCode kKeys[] = { |
| 1898 ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, ui::VKEY_UNKNOWN | 1876 ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, ui::VKEY_UNKNOWN |
| 1899 }; | 1877 }; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 | 1977 |
| 2000 // Now Shift+Right should do nothing, and Shift+Left should reduce. | 1978 // Now Shift+Right should do nothing, and Shift+Left should reduce. |
| 2001 // At the end, so Shift+Right should do nothing. | 1979 // At the end, so Shift+Right should do nothing. |
| 2002 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, ui::EF_SHIFT_DOWN)); | 1980 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, ui::EF_SHIFT_DOWN)); |
| 2003 EXPECT_EQ(2u, GetSelectionSize(omnibox_view)); | 1981 EXPECT_EQ(2u, GetSelectionSize(omnibox_view)); |
| 2004 | 1982 |
| 2005 // And Left should reduce by one character. | 1983 // And Left should reduce by one character. |
| 2006 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN)); | 1984 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN)); |
| 2007 EXPECT_EQ(1u, GetSelectionSize(omnibox_view)); | 1985 EXPECT_EQ(1u, GetSelectionSize(omnibox_view)); |
| 2008 } | 1986 } |
| OLD | NEW |