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/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 #endif | 1576 #endif |
1577 omnibox_view->CloseOmniboxPopup(); | 1577 omnibox_view->CloseOmniboxPopup(); |
1578 EXPECT_FALSE(popup_model->IsOpen()); | 1578 EXPECT_FALSE(popup_model->IsOpen()); |
1579 | 1579 |
1580 // Pasting amid text should yield the expected text and re-open the popup. | 1580 // Pasting amid text should yield the expected text and re-open the popup. |
1581 omnibox_view->SetWindowTextAndCaretPos(ASCIIToUTF16("abcd"), 2, false, false); | 1581 omnibox_view->SetWindowTextAndCaretPos(ASCIIToUTF16("abcd"), 2, false, false); |
1582 SetClipboardText(ASCIIToUTF16("123")); | 1582 SetClipboardText(ASCIIToUTF16("123")); |
1583 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, kCtrlOrCmdMask)); | 1583 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, kCtrlOrCmdMask)); |
1584 EXPECT_EQ(ASCIIToUTF16("ab123cd"), omnibox_view->GetText()); | 1584 EXPECT_EQ(ASCIIToUTF16("ab123cd"), omnibox_view->GetText()); |
1585 EXPECT_TRUE(popup_model->IsOpen()); | 1585 EXPECT_TRUE(popup_model->IsOpen()); |
| 1586 |
| 1587 // Ctrl/Cmd+Alt+V should not paste. |
| 1588 ASSERT_NO_FATAL_FAILURE( |
| 1589 SendKey(ui::VKEY_V, kCtrlOrCmdMask | ui::EF_ALT_DOWN)); |
| 1590 EXPECT_EQ(ASCIIToUTF16("ab123cd"), omnibox_view->GetText()); |
| 1591 // TODO(msw): Test that AltGr+V does not paste. |
1586 } | 1592 } |
1587 | 1593 |
1588 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CopyURLToClipboard) { | 1594 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CopyURLToClipboard) { |
1589 // Set permanent text thus making sure that omnibox treats 'google.com' | 1595 // Set permanent text thus making sure that omnibox treats 'google.com' |
1590 // as URL (not as ordinary user input). | 1596 // as URL (not as ordinary user input). |
1591 TestToolbarModel* test_toolbar_model = new TestToolbarModel; | 1597 TestToolbarModel* test_toolbar_model = new TestToolbarModel; |
1592 scoped_ptr<ToolbarModel> toolbar_model(test_toolbar_model); | 1598 scoped_ptr<ToolbarModel> toolbar_model(test_toolbar_model); |
1593 test_toolbar_model->set_text(ASCIIToUTF16("http://www.google.com/")); | 1599 test_toolbar_model->set_text(ASCIIToUTF16("http://www.google.com/")); |
1594 browser()->swap_toolbar_models(&toolbar_model); | 1600 browser()->swap_toolbar_models(&toolbar_model); |
1595 OmniboxView* omnibox_view = NULL; | 1601 OmniboxView* omnibox_view = NULL; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 omnibox_view->Update(); | 1858 omnibox_view->Update(); |
1853 EXPECT_EQ(url_c, omnibox_view->GetText()); | 1859 EXPECT_EQ(url_c, omnibox_view->GetText()); |
1854 } | 1860 } |
1855 | 1861 |
1856 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, InputResetsSearchTermReplacement) { | 1862 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, InputResetsSearchTermReplacement) { |
1857 browser()->toolbar_model()->set_search_term_replacement_enabled(false); | 1863 browser()->toolbar_model()->set_search_term_replacement_enabled(false); |
1858 chrome::FocusLocationBar(browser()); | 1864 chrome::FocusLocationBar(browser()); |
1859 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); | 1865 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); |
1860 EXPECT_TRUE(browser()->toolbar_model()->search_term_replacement_enabled()); | 1866 EXPECT_TRUE(browser()->toolbar_model()->search_term_replacement_enabled()); |
1861 } | 1867 } |
OLD | NEW |