| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 int modifiers = blink::WebInputEvent::MetaKey; | 2625 int modifiers = blink::WebInputEvent::MetaKey; |
| 2626 #else | 2626 #else |
| 2627 int modifiers = blink::WebInputEvent::ControlKey; | 2627 int modifiers = blink::WebInputEvent::ControlKey; |
| 2628 #endif | 2628 #endif |
| 2629 modifiers |= blink::WebInputEvent::ShiftKey; | 2629 modifiers |= blink::WebInputEvent::ShiftKey; |
| 2630 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; | 2630 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; |
| 2631 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; | 2631 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; |
| 2632 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); | 2632 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); |
| 2633 } | 2633 } |
| 2634 | 2634 |
| 2635 // Middle-clicks open in a background tab. | |
| 2636 #if defined(OS_LINUX) | |
| 2637 // http://crbug.com/396347 | |
| 2638 #define MAYBE_WindowOpenMiddleClickTest DISABLED_WindowOpenMiddleClickTest | |
| 2639 #else | |
| 2640 #define MAYBE_WindowOpenMiddleClickTest WindowOpenMiddleClickTest | |
| 2641 #endif | |
| 2642 IN_PROC_BROWSER_TEST_F(ClickModifierTest, MAYBE_WindowOpenMiddleClickTest) { | |
| 2643 int modifiers = 0; | |
| 2644 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonMiddle; | |
| 2645 WindowOpenDisposition disposition = NEW_BACKGROUND_TAB; | |
| 2646 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); | |
| 2647 } | |
| 2648 | |
| 2649 // Shift-middle-clicks open in a foreground tab. | |
| 2650 IN_PROC_BROWSER_TEST_F(ClickModifierTest, WindowOpenShiftMiddleClickTest) { | |
| 2651 int modifiers = blink::WebInputEvent::ShiftKey; | |
| 2652 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonMiddle; | |
| 2653 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; | |
| 2654 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); | |
| 2655 } | |
| 2656 | |
| 2657 // Tests for clicking on normal links. | 2635 // Tests for clicking on normal links. |
| 2658 | 2636 |
| 2659 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefBasicClickTest) { | 2637 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefBasicClickTest) { |
| 2660 int modifiers = 0; | 2638 int modifiers = 0; |
| 2661 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; | 2639 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; |
| 2662 WindowOpenDisposition disposition = CURRENT_TAB; | 2640 WindowOpenDisposition disposition = CURRENT_TAB; |
| 2663 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); | 2641 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); |
| 2664 } | 2642 } |
| 2665 | 2643 |
| 2666 // TODO(ericu): Alt-click behavior on links is platform-dependent and not well | 2644 // TODO(ericu): Alt-click behavior on links is platform-dependent and not well |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3270 Browser* browser = new Browser(params); | 3248 Browser* browser = new Browser(params); |
| 3271 gfx::Rect bounds = browser->window()->GetBounds(); | 3249 gfx::Rect bounds = browser->window()->GetBounds(); |
| 3272 | 3250 |
| 3273 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 3251 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 3274 // See https://crbug.com/567925. | 3252 // See https://crbug.com/567925. |
| 3275 EXPECT_GE(bounds.width(), 100); | 3253 EXPECT_GE(bounds.width(), 100); |
| 3276 EXPECT_EQ(122, bounds.height()); | 3254 EXPECT_EQ(122, bounds.height()); |
| 3277 browser->window()->Close(); | 3255 browser->window()->Close(); |
| 3278 } | 3256 } |
| 3279 } | 3257 } |
| OLD | NEW |