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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 OmniboxView* omnibox_view = NULL; | 1669 OmniboxView* omnibox_view = NULL; |
1670 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1670 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
1671 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_EDIT_SEARCH_ENGINES)); | 1671 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_EDIT_SEARCH_ENGINES)); |
1672 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 1672 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
1673 const std::string target_url = | 1673 const std::string target_url = |
1674 std::string(chrome::kChromeUISettingsURL) + chrome::kSearchEnginesSubPage; | 1674 std::string(chrome::kChromeUISettingsURL) + chrome::kSearchEnginesSubPage; |
1675 EXPECT_EQ(ASCIIToUTF16(target_url), omnibox_view->GetText()); | 1675 EXPECT_EQ(ASCIIToUTF16(target_url), omnibox_view->GetText()); |
1676 EXPECT_FALSE(omnibox_view->model()->popup_model()->IsOpen()); | 1676 EXPECT_FALSE(omnibox_view->model()->popup_model()->IsOpen()); |
1677 } | 1677 } |
1678 | 1678 |
1679 #if defined(OS_MACOSX) | 1679 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BeginningShownAfterBlur) { |
1680 // http://crbug.com/406012 | |
1681 #define MAYBE_BeginningShownAfterBlur DISABLED_BeginningShownAfterBlur | |
1682 #else | |
1683 #define MAYBE_BeginningShownAfterBlur BeginningShownAfterBlur | |
1684 #endif | |
1685 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_BeginningShownAfterBlur) { | |
1686 OmniboxView* omnibox_view = NULL; | 1680 OmniboxView* omnibox_view = NULL; |
1687 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1681 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
1688 | 1682 |
1689 omnibox_view->OnBeforePossibleChange(); | 1683 omnibox_view->OnBeforePossibleChange(); |
1690 omnibox_view->SetWindowTextAndCaretPos(ASCIIToUTF16("data:text/plain,test"), | 1684 omnibox_view->SetWindowTextAndCaretPos(ASCIIToUTF16("data:text/plain,test"), |
1691 5U, false, false); | 1685 5U, false, false); |
1692 omnibox_view->OnAfterPossibleChange(); | 1686 omnibox_view->OnAfterPossibleChange(); |
1693 ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | 1687 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); |
1694 size_t start, end; | 1688 size_t start, end; |
1695 omnibox_view->GetSelectionBounds(&start, &end); | 1689 omnibox_view->GetSelectionBounds(&start, &end); |
1696 ASSERT_EQ(5U, start); | 1690 EXPECT_EQ(5U, start); |
1697 ASSERT_EQ(5U, end); | 1691 EXPECT_EQ(5U, end); |
1698 | 1692 |
1699 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); | 1693 ui_test_utils::FocusView(browser(), VIEW_ID_TAB_CONTAINER); |
1700 ASSERT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | 1694 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); |
1701 | 1695 |
1702 omnibox_view->GetSelectionBounds(&start, &end); | 1696 omnibox_view->GetSelectionBounds(&start, &end); |
1703 ASSERT_EQ(0U, start); | 1697 EXPECT_EQ(0U, start); |
1704 ASSERT_EQ(0U, end); | 1698 EXPECT_EQ(0U, end); |
1705 } | 1699 } |
1706 | 1700 |
1707 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CtrlArrowAfterArrowSuggestions) { | 1701 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CtrlArrowAfterArrowSuggestions) { |
1708 OmniboxView* omnibox_view = NULL; | 1702 OmniboxView* omnibox_view = NULL; |
1709 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1703 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
1710 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 1704 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
1711 ASSERT_TRUE(popup_model); | 1705 ASSERT_TRUE(popup_model); |
1712 | 1706 |
1713 // Input something to trigger results. | 1707 // Input something to trigger results. |
1714 const ui::KeyboardCode kKeys[] = { | 1708 const ui::KeyboardCode kKeys[] = { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 omnibox_view->Update(); | 1793 omnibox_view->Update(); |
1800 EXPECT_EQ(url_c, omnibox_view->GetText()); | 1794 EXPECT_EQ(url_c, omnibox_view->GetText()); |
1801 } | 1795 } |
1802 | 1796 |
1803 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { | 1797 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { |
1804 browser()->toolbar_model()->set_url_replacement_enabled(true); | 1798 browser()->toolbar_model()->set_url_replacement_enabled(true); |
1805 chrome::FocusLocationBar(browser()); | 1799 chrome::FocusLocationBar(browser()); |
1806 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); | 1800 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); |
1807 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); | 1801 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); |
1808 } | 1802 } |
OLD | NEW |