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

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

Issue 26248004: Views Textfield/Omnibox: Do not paste on Ctrl+Alt[Gr]+V or AltGr+V. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unsupported AltGr test cases. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/omnibox/omnibox_view_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 #endif 1574 #endif
1575 omnibox_view->CloseOmniboxPopup(); 1575 omnibox_view->CloseOmniboxPopup();
1576 EXPECT_FALSE(popup_model->IsOpen()); 1576 EXPECT_FALSE(popup_model->IsOpen());
1577 1577
1578 // Pasting amid text should yield the expected text and re-open the popup. 1578 // Pasting amid text should yield the expected text and re-open the popup.
1579 omnibox_view->SetWindowTextAndCaretPos(ASCIIToUTF16("abcd"), 2, false, false); 1579 omnibox_view->SetWindowTextAndCaretPos(ASCIIToUTF16("abcd"), 2, false, false);
1580 SetClipboardText(ASCIIToUTF16("123")); 1580 SetClipboardText(ASCIIToUTF16("123"));
1581 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, kCtrlOrCmdMask)); 1581 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, kCtrlOrCmdMask));
1582 EXPECT_EQ(ASCIIToUTF16("ab123cd"), omnibox_view->GetText()); 1582 EXPECT_EQ(ASCIIToUTF16("ab123cd"), omnibox_view->GetText());
1583 EXPECT_TRUE(popup_model->IsOpen()); 1583 EXPECT_TRUE(popup_model->IsOpen());
1584
1585 // The Alt key should stifle the Control+V or Command+V paste shortcut.
Peter Kasting 2013/10/08 02:38:53 Nit: Simpler and clearer: "Ctrl-alt-v should not p
msw 2013/10/08 03:37:48 Done.
1586 ASSERT_NO_FATAL_FAILURE(
1587 SendKey(ui::VKEY_V, kCtrlOrCmdMask | ui::EF_ALT_DOWN));
1588 EXPECT_EQ(ASCIIToUTF16("ab123cd"), omnibox_view->GetText());
1589 // TODO(msw): Test that AltGr+V does not invoke paste.
1584 } 1590 }
1585 1591
1586 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CopyURLToClipboard) { 1592 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CopyURLToClipboard) {
1587 // Set permanent text thus making sure that omnibox treats 'google.com' 1593 // Set permanent text thus making sure that omnibox treats 'google.com'
1588 // as URL (not as ordinary user input). 1594 // as URL (not as ordinary user input).
1589 TestToolbarModel* test_toolbar_model = new TestToolbarModel; 1595 TestToolbarModel* test_toolbar_model = new TestToolbarModel;
1590 scoped_ptr<ToolbarModel> toolbar_model(test_toolbar_model); 1596 scoped_ptr<ToolbarModel> toolbar_model(test_toolbar_model);
1591 test_toolbar_model->set_text(ASCIIToUTF16("http://www.google.com/")); 1597 test_toolbar_model->set_text(ASCIIToUTF16("http://www.google.com/"));
1592 browser()->swap_toolbar_models(&toolbar_model); 1598 browser()->swap_toolbar_models(&toolbar_model);
1593 OmniboxView* omnibox_view = NULL; 1599 OmniboxView* omnibox_view = NULL;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 omnibox_view->Update(); 1856 omnibox_view->Update();
1851 EXPECT_EQ(url_c, omnibox_view->GetText()); 1857 EXPECT_EQ(url_c, omnibox_view->GetText());
1852 } 1858 }
1853 1859
1854 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, InputResetsSearchTermReplacement) { 1860 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, InputResetsSearchTermReplacement) {
1855 browser()->toolbar_model()->set_search_term_replacement_enabled(false); 1861 browser()->toolbar_model()->set_search_term_replacement_enabled(false);
1856 chrome::FocusLocationBar(browser()); 1862 chrome::FocusLocationBar(browser());
1857 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); 1863 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0));
1858 EXPECT_TRUE(browser()->toolbar_model()->search_term_replacement_enabled()); 1864 EXPECT_TRUE(browser()->toolbar_model()->search_term_replacement_enabled());
1859 } 1865 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/omnibox/omnibox_view_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698