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

Side by Side Diff: chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc

Issue 1124963003: Remove ui::KeycodeConverter::CodeToNativeKeycode(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@x444048-3a-codes
Patch Set: rebase Created 5 years, 7 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
« no previous file with comments | « no previous file | content/content_renderer.gypi » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 27 matching lines...) Expand all
38 #include "content/public/browser/render_frame_host.h" 38 #include "content/public/browser/render_frame_host.h"
39 #include "content/public/browser/render_view_host.h" 39 #include "content/public/browser/render_view_host.h"
40 #include "content/public/browser/web_contents.h" 40 #include "content/public/browser/web_contents.h"
41 #include "content/public/browser/web_contents_observer.h" 41 #include "content/public/browser/web_contents_observer.h"
42 #include "content/public/common/url_constants.h" 42 #include "content/public/common/url_constants.h"
43 #include "content/public/test/browser_test_utils.h" 43 #include "content/public/test/browser_test_utils.h"
44 #include "content/public/test/test_navigation_observer.h" 44 #include "content/public/test/test_navigation_observer.h"
45 #include "net/dns/mock_host_resolver.h" 45 #include "net/dns/mock_host_resolver.h"
46 #include "net/test/embedded_test_server/embedded_test_server.h" 46 #include "net/test/embedded_test_server/embedded_test_server.h"
47 #include "testing/gtest/include/gtest/gtest.h" 47 #include "testing/gtest/include/gtest/gtest.h"
48 #include "ui/events/keycodes/dom/dom_code.h"
48 #include "ui/events/keycodes/dom/keycode_converter.h" 49 #include "ui/events/keycodes/dom/keycode_converter.h"
49 50
50 using content::WebContents; 51 using content::WebContents;
51 using content::NativeWebKeyboardEvent; 52 using content::NativeWebKeyboardEvent;
52 53
53 namespace { 54 namespace {
54 55
55 // Counts the number of RenderViewHosts created. 56 // Counts the number of RenderViewHosts created.
56 class CountRenderViewHosts : public content::NotificationObserver { 57 class CountRenderViewHosts : public content::NotificationObserver {
57 public: 58 public:
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 GURL url(embedded_test_server()->GetURL( 631 GURL url(embedded_test_server()->GetURL(
631 "/popup_blocker/popup-simulated-click-on-anchor.html")); 632 "/popup_blocker/popup-simulated-click-on-anchor.html"));
632 ui_test_utils::NavigateToURL(browser(), url); 633 ui_test_utils::NavigateToURL(browser(), url);
633 634
634 content::WindowedNotificationObserver wait_for_new_tab( 635 content::WindowedNotificationObserver wait_for_new_tab(
635 chrome::NOTIFICATION_TAB_ADDED, 636 chrome::NOTIFICATION_TAB_ADDED,
636 content::NotificationService::AllSources()); 637 content::NotificationService::AllSources());
637 638
638 #if defined(OS_MACOSX) 639 #if defined(OS_MACOSX)
639 int modifiers = blink::WebInputEvent::MetaKey; 640 int modifiers = blink::WebInputEvent::MetaKey;
640 InjectRawKeyEvent(tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_COMMAND, 641 InjectRawKeyEvent(
641 ui::KeycodeConverter::CodeToNativeKeycode("OSLeft"), 642 tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_COMMAND,
642 modifiers); 643 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::OS_LEFT),
644 modifiers);
643 #else 645 #else
644 int modifiers = blink::WebInputEvent::ControlKey; 646 int modifiers = blink::WebInputEvent::ControlKey;
645 InjectRawKeyEvent(tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_CONTROL, 647 InjectRawKeyEvent(
646 ui::KeycodeConverter::CodeToNativeKeycode("ControlLeft"), 648 tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_CONTROL,
647 modifiers); 649 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::CONTROL_LEFT),
650 modifiers);
648 #endif 651 #endif
649 652
650 InjectRawKeyEvent(tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_RETURN, 653 InjectRawKeyEvent(tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_RETURN,
651 ui::KeycodeConverter::CodeToNativeKeycode(NULL), modifiers); 654 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers);
652 655
653 InjectRawKeyEvent(tab, blink::WebInputEvent::Char, ui::VKEY_RETURN, 656 InjectRawKeyEvent(tab, blink::WebInputEvent::Char, ui::VKEY_RETURN,
654 ui::KeycodeConverter::CodeToNativeKeycode(NULL), modifiers); 657 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers);
655 658
656 InjectRawKeyEvent(tab, blink::WebInputEvent::KeyUp, ui::VKEY_RETURN, 659 InjectRawKeyEvent(tab, blink::WebInputEvent::KeyUp, ui::VKEY_RETURN,
657 ui::KeycodeConverter::CodeToNativeKeycode(NULL), modifiers); 660 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers);
658 661
659 #if defined(OS_MACOSX) 662 #if defined(OS_MACOSX)
660 InjectRawKeyEvent(tab, blink::WebInputEvent::KeyUp, ui::VKEY_COMMAND, 663 InjectRawKeyEvent(
661 ui::KeycodeConverter::CodeToNativeKeycode("OSLeft"), 664 tab, blink::WebInputEvent::KeyUp, ui::VKEY_COMMAND,
662 modifiers); 665 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::OS_LEFT),
666 modifiers);
663 #else 667 #else
664 InjectRawKeyEvent(tab, blink::WebInputEvent::KeyUp, ui::VKEY_CONTROL, 668 InjectRawKeyEvent(
665 ui::KeycodeConverter::CodeToNativeKeycode("ControlLeft"), 669 tab, blink::WebInputEvent::KeyUp, ui::VKEY_CONTROL,
666 modifiers); 670 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::CONTROL_LEFT),
671 modifiers);
667 #endif 672 #endif
668
669 wait_for_new_tab.Wait(); 673 wait_for_new_tab.Wait();
670 674
671 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 675 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
672 browser()->host_desktop_type())); 676 browser()->host_desktop_type()));
673 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 677 ASSERT_EQ(2, browser()->tab_strip_model()->count());
674 // Check that we create the background tab. 678 // Check that we create the background tab.
675 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); 679 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
676 } 680 }
677 681
678 // Tests that the tapping gesture with cntl/cmd key on a link open the 682 // Tests that the tapping gesture with cntl/cmd key on a link open the
(...skipping 19 matching lines...) Expand all
698 wait_for_new_tab.Wait(); 702 wait_for_new_tab.Wait();
699 703
700 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 704 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
701 browser()->host_desktop_type())); 705 browser()->host_desktop_type()));
702 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 706 ASSERT_EQ(2, browser()->tab_strip_model()->count());
703 // Check that we create the background tab. 707 // Check that we create the background tab.
704 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); 708 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
705 } 709 }
706 710
707 } // namespace 711 } // namespace
OLDNEW
« no previous file with comments | « no previous file | content/content_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698