| 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/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); | 577 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); |
| 578 EXPECT_TRUE(omnibox_view->GetText().empty()); | 578 EXPECT_TRUE(omnibox_view->GetText().empty()); |
| 579 | 579 |
| 580 // Escape shall revert the text in omnibox. | 580 // Escape shall revert the text in omnibox. |
| 581 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); | 581 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); |
| 582 EXPECT_EQ(old_text, omnibox_view->GetText()); | 582 EXPECT_EQ(old_text, omnibox_view->GetText()); |
| 583 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 583 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
| 584 } | 584 } |
| 585 #undef MAYBE_ESCAPE | 585 #undef MAYBE_ESCAPE |
| 586 | 586 |
| 587 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLD) { | 587 #if defined(OS_LINUX) |
| 588 #define MAYBE_DesiredTLD DISABLED_DesiredTLD |
| 589 #else |
| 590 #define MAYBE_DesiredTLD DesiredTLD |
| 591 #endif |
| 592 |
| 593 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_DesiredTLD) { |
| 588 OmniboxView* omnibox_view = NULL; | 594 OmniboxView* omnibox_view = NULL; |
| 589 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 595 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 590 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 596 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
| 591 ASSERT_TRUE(popup_model); | 597 ASSERT_TRUE(popup_model); |
| 592 | 598 |
| 593 // Test ctrl-Enter. | 599 // Test ctrl-Enter. |
| 594 const ui::KeyboardCode kKeys[] = { | 600 const ui::KeyboardCode kKeys[] = { |
| 595 ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, ui::VKEY_UNKNOWN | 601 ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, ui::VKEY_UNKNOWN |
| 596 }; | 602 }; |
| 597 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kKeys)); | 603 ASSERT_NO_FATAL_FAILURE(SendKeySequence(kKeys)); |
| 598 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); | 604 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); |
| 599 ASSERT_TRUE(popup_model->IsOpen()); | 605 ASSERT_TRUE(popup_model->IsOpen()); |
| 600 // ctrl-Enter triggers desired_tld feature, thus www.bar.com shall be | 606 // ctrl-Enter triggers desired_tld feature, thus www.bar.com shall be |
| 601 // opened. | 607 // opened. |
| 602 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, ui::EF_CONTROL_DOWN, | 608 ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, ui::EF_CONTROL_DOWN, |
| 603 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 609 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 604 content::Source<content::NavigationController>( | 610 content::Source<content::NavigationController>( |
| 605 &browser()->tab_strip_model()->GetActiveWebContents()-> | 611 &browser()->tab_strip_model()->GetActiveWebContents()-> |
| 606 GetController()))); | 612 GetController()))); |
| 607 | 613 |
| 608 GURL url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); | 614 GURL url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); |
| 609 EXPECT_EQ("www.bar.com", url.host()); | 615 EXPECT_EQ("www.bar.com", url.host()); |
| 610 EXPECT_EQ("/", url.path()); | 616 EXPECT_EQ("/", url.path()); |
| 611 } | 617 } |
| 612 | 618 |
| 613 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLDWithTemporaryText) { | 619 #if defined(OS_LINUX) |
| 620 #define MAYBE_DesiredTLDWithTemporaryText DISABLED_DesiredTLDWithTemporaryText |
| 621 #else |
| 622 #define MAYBE_DesiredTLDWithTemporaryText DesiredTLDWithTemporaryText |
| 623 #endif |
| 624 |
| 625 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_DesiredTLDWithTemporaryText) { |
| 614 OmniboxView* omnibox_view = NULL; | 626 OmniboxView* omnibox_view = NULL; |
| 615 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 627 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 616 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 628 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
| 617 ASSERT_TRUE(popup_model); | 629 ASSERT_TRUE(popup_model); |
| 618 | 630 |
| 619 Profile* profile = browser()->profile(); | 631 Profile* profile = browser()->profile(); |
| 620 TemplateURLService* template_url_service = | 632 TemplateURLService* template_url_service = |
| 621 TemplateURLServiceFactory::GetForProfile(profile); | 633 TemplateURLServiceFactory::GetForProfile(profile); |
| 622 | 634 |
| 623 // Add a non-substituting keyword. This ensures the popup will have a | 635 // Add a non-substituting keyword. This ensures the popup will have a |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 omnibox_view->Update(); | 1858 omnibox_view->Update(); |
| 1847 EXPECT_EQ(url_c, omnibox_view->GetText()); | 1859 EXPECT_EQ(url_c, omnibox_view->GetText()); |
| 1848 } | 1860 } |
| 1849 | 1861 |
| 1850 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { | 1862 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { |
| 1851 browser()->toolbar_model()->set_url_replacement_enabled(true); | 1863 browser()->toolbar_model()->set_url_replacement_enabled(true); |
| 1852 chrome::FocusLocationBar(browser()); | 1864 chrome::FocusLocationBar(browser()); |
| 1853 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); | 1865 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); |
| 1854 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); | 1866 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); |
| 1855 } | 1867 } |
| OLD | NEW |