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 "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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 668 |
669 wait_for_new_tab.Wait(); | 669 wait_for_new_tab.Wait(); |
670 | 670 |
671 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), | 671 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
672 browser()->host_desktop_type())); | 672 browser()->host_desktop_type())); |
673 ASSERT_EQ(2, browser()->tab_strip_model()->count()); | 673 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
674 // Check that we create the background tab. | 674 // Check that we create the background tab. |
675 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 675 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
676 } | 676 } |
677 | 677 |
| 678 // Tests that the tapping gesture with cntl/cmd key on a link open the |
| 679 // backgournd tab. |
| 680 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, TapGestureWithCtrlKey) { |
| 681 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 682 |
| 683 GURL url(embedded_test_server()->GetURL( |
| 684 "/popup_blocker/popup-simulated-click-on-anchor2.html")); |
| 685 ui_test_utils::NavigateToURL(browser(), url); |
| 686 |
| 687 content::WindowedNotificationObserver wait_for_new_tab( |
| 688 chrome::NOTIFICATION_TAB_ADDED, |
| 689 content::NotificationService::AllSources()); |
| 690 |
| 691 #if defined(OS_MACOSX) |
| 692 unsigned modifiers = blink::WebInputEvent::MetaKey; |
| 693 #else |
| 694 unsigned modifiers = blink::WebInputEvent::ControlKey; |
| 695 #endif |
| 696 content::SimulateTapWithModifiersAt(tab, modifiers, gfx::Point(350, 250)); |
| 697 |
| 698 wait_for_new_tab.Wait(); |
| 699 |
| 700 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
| 701 browser()->host_desktop_type())); |
| 702 ASSERT_EQ(2, browser()->tab_strip_model()->count()); |
| 703 // Check that we create the background tab. |
| 704 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 705 } |
| 706 |
678 } // namespace | 707 } // namespace |
OLD | NEW |