OLD | NEW |
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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 ui_test_utils::NavigateToURL(browser(), url); | 620 ui_test_utils::NavigateToURL(browser(), url); |
621 | 621 |
622 content::WindowedNotificationObserver wait_for_new_tab( | 622 content::WindowedNotificationObserver wait_for_new_tab( |
623 chrome::NOTIFICATION_TAB_ADDED, | 623 chrome::NOTIFICATION_TAB_ADDED, |
624 content::NotificationService::AllSources()); | 624 content::NotificationService::AllSources()); |
625 | 625 |
626 #if defined(OS_MACOSX) | 626 #if defined(OS_MACOSX) |
627 int modifiers = blink::WebInputEvent::MetaKey; | 627 int modifiers = blink::WebInputEvent::MetaKey; |
628 InjectRawKeyEvent( | 628 InjectRawKeyEvent( |
629 tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_COMMAND, | 629 tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_COMMAND, |
630 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::OS_LEFT), | 630 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::META_LEFT), |
631 modifiers); | 631 modifiers); |
632 #else | 632 #else |
633 int modifiers = blink::WebInputEvent::ControlKey; | 633 int modifiers = blink::WebInputEvent::ControlKey; |
634 InjectRawKeyEvent( | 634 InjectRawKeyEvent( |
635 tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_CONTROL, | 635 tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_CONTROL, |
636 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::CONTROL_LEFT), | 636 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::CONTROL_LEFT), |
637 modifiers); | 637 modifiers); |
638 #endif | 638 #endif |
639 | 639 |
640 InjectRawKeyEvent(tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_RETURN, | 640 InjectRawKeyEvent(tab, blink::WebInputEvent::RawKeyDown, ui::VKEY_RETURN, |
641 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers); | 641 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers); |
642 | 642 |
643 InjectRawKeyEvent(tab, blink::WebInputEvent::Char, ui::VKEY_RETURN, | 643 InjectRawKeyEvent(tab, blink::WebInputEvent::Char, ui::VKEY_RETURN, |
644 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers); | 644 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers); |
645 | 645 |
646 InjectRawKeyEvent(tab, blink::WebInputEvent::KeyUp, ui::VKEY_RETURN, | 646 InjectRawKeyEvent(tab, blink::WebInputEvent::KeyUp, ui::VKEY_RETURN, |
647 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers); | 647 ui::KeycodeConverter::InvalidNativeKeycode(), modifiers); |
648 | 648 |
649 #if defined(OS_MACOSX) | 649 #if defined(OS_MACOSX) |
650 InjectRawKeyEvent( | 650 InjectRawKeyEvent( |
651 tab, blink::WebInputEvent::KeyUp, ui::VKEY_COMMAND, | 651 tab, blink::WebInputEvent::KeyUp, ui::VKEY_COMMAND, |
652 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::OS_LEFT), | 652 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::META_LEFT), |
653 modifiers); | 653 modifiers); |
654 #else | 654 #else |
655 InjectRawKeyEvent( | 655 InjectRawKeyEvent( |
656 tab, blink::WebInputEvent::KeyUp, ui::VKEY_CONTROL, | 656 tab, blink::WebInputEvent::KeyUp, ui::VKEY_CONTROL, |
657 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::CONTROL_LEFT), | 657 ui::KeycodeConverter::DomCodeToNativeKeycode(ui::DomCode::CONTROL_LEFT), |
658 modifiers); | 658 modifiers); |
659 #endif | 659 #endif |
660 wait_for_new_tab.Wait(); | 660 wait_for_new_tab.Wait(); |
661 | 661 |
662 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); | 662 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); |
(...skipping 24 matching lines...) Expand all Loading... |
687 | 687 |
688 wait_for_new_tab.Wait(); | 688 wait_for_new_tab.Wait(); |
689 | 689 |
690 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); | 690 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); |
691 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 691 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
692 // Check that we create the background tab. | 692 // Check that we create the background tab. |
693 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 693 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
694 } | 694 } |
695 | 695 |
696 } // namespace | 696 } // namespace |
OLD | NEW |