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 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 int modifiers = blink::WebInputEvent::MetaKey; | 2582 int modifiers = blink::WebInputEvent::MetaKey; |
2583 #else | 2583 #else |
2584 int modifiers = blink::WebInputEvent::ControlKey; | 2584 int modifiers = blink::WebInputEvent::ControlKey; |
2585 #endif | 2585 #endif |
2586 modifiers |= blink::WebInputEvent::ShiftKey; | 2586 modifiers |= blink::WebInputEvent::ShiftKey; |
2587 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; | 2587 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; |
2588 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; | 2588 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; |
2589 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); | 2589 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); |
2590 } | 2590 } |
2591 | 2591 |
| 2592 // Middle-clicks open in a background tab. |
| 2593 #if defined(OS_LINUX) |
| 2594 // http://crbug.com/396347 |
| 2595 #define MAYBE_WindowOpenMiddleClickTest DISABLED_WindowOpenMiddleClickTest |
| 2596 #else |
| 2597 #define MAYBE_WindowOpenMiddleClickTest WindowOpenMiddleClickTest |
| 2598 #endif |
| 2599 IN_PROC_BROWSER_TEST_F(ClickModifierTest, MAYBE_WindowOpenMiddleClickTest) { |
| 2600 int modifiers = 0; |
| 2601 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonMiddle; |
| 2602 WindowOpenDisposition disposition = NEW_BACKGROUND_TAB; |
| 2603 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); |
| 2604 } |
| 2605 |
| 2606 // Shift-middle-clicks open in a foreground tab. |
| 2607 IN_PROC_BROWSER_TEST_F(ClickModifierTest, WindowOpenShiftMiddleClickTest) { |
| 2608 int modifiers = blink::WebInputEvent::ShiftKey; |
| 2609 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonMiddle; |
| 2610 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; |
| 2611 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); |
| 2612 } |
| 2613 |
2592 // Tests for clicking on normal links. | 2614 // Tests for clicking on normal links. |
2593 | 2615 |
2594 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefBasicClickTest) { | 2616 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefBasicClickTest) { |
2595 int modifiers = 0; | 2617 int modifiers = 0; |
2596 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; | 2618 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; |
2597 WindowOpenDisposition disposition = CURRENT_TAB; | 2619 WindowOpenDisposition disposition = CURRENT_TAB; |
2598 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); | 2620 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); |
2599 } | 2621 } |
2600 | 2622 |
2601 // TODO(ericu): Alt-click behavior on links is platform-dependent and not well | 2623 // TODO(ericu): Alt-click behavior on links is platform-dependent and not well |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3308 Browser* browser = new Browser(params); | 3330 Browser* browser = new Browser(params); |
3309 gfx::Rect bounds = browser->window()->GetBounds(); | 3331 gfx::Rect bounds = browser->window()->GetBounds(); |
3310 | 3332 |
3311 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 3333 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
3312 // See https://crbug.com/567925. | 3334 // See https://crbug.com/567925. |
3313 EXPECT_GE(bounds.width(), 100); | 3335 EXPECT_GE(bounds.width(), 100); |
3314 EXPECT_EQ(122, bounds.height()); | 3336 EXPECT_EQ(122, bounds.height()); |
3315 browser->window()->Close(); | 3337 browser->window()->Close(); |
3316 } | 3338 } |
3317 } | 3339 } |
OLD | NEW |