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 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2453 int modifiers = blink::WebInputEvent::MetaKey; | 2453 int modifiers = blink::WebInputEvent::MetaKey; |
2454 #else | 2454 #else |
2455 int modifiers = blink::WebInputEvent::ControlKey; | 2455 int modifiers = blink::WebInputEvent::ControlKey; |
2456 #endif | 2456 #endif |
2457 modifiers |= blink::WebInputEvent::ShiftKey; | 2457 modifiers |= blink::WebInputEvent::ShiftKey; |
2458 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; | 2458 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; |
2459 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; | 2459 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; |
2460 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); | 2460 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); |
2461 } | 2461 } |
2462 | 2462 |
2463 // Middle-clicks open in a background tab. | |
2464 #if defined(OS_LINUX) | |
2465 // http://crbug.com/396347 | |
2466 #define MAYBE_WindowOpenMiddleClickTest DISABLED_WindowOpenMiddleClickTest | |
2467 #else | |
2468 #define MAYBE_WindowOpenMiddleClickTest WindowOpenMiddleClickTest | |
2469 #endif | |
2470 IN_PROC_BROWSER_TEST_F(ClickModifierTest, MAYBE_WindowOpenMiddleClickTest) { | |
2471 int modifiers = 0; | |
2472 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonMiddle; | |
2473 WindowOpenDisposition disposition = NEW_BACKGROUND_TAB; | |
2474 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); | |
2475 } | |
2476 | |
2477 // Shift-middle-clicks open in a foreground tab. | |
2478 IN_PROC_BROWSER_TEST_F(ClickModifierTest, WindowOpenShiftMiddleClickTest) { | |
2479 int modifiers = blink::WebInputEvent::ShiftKey; | |
2480 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonMiddle; | |
2481 WindowOpenDisposition disposition = NEW_FOREGROUND_TAB; | |
2482 RunTest(browser(), GetWindowOpenURL(), modifiers, button, disposition); | |
2483 } | |
2484 | |
2485 // Tests for clicking on normal links. | 2463 // Tests for clicking on normal links. |
2486 | 2464 |
2487 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefBasicClickTest) { | 2465 IN_PROC_BROWSER_TEST_F(ClickModifierTest, HrefBasicClickTest) { |
2488 int modifiers = 0; | 2466 int modifiers = 0; |
2489 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; | 2467 blink::WebMouseEvent::Button button = blink::WebMouseEvent::ButtonLeft; |
2490 WindowOpenDisposition disposition = CURRENT_TAB; | 2468 WindowOpenDisposition disposition = CURRENT_TAB; |
2491 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); | 2469 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); |
2492 } | 2470 } |
2493 | 2471 |
2494 // TODO(ericu): Alt-click behavior on links is platform-dependent and not well | 2472 // TODO(ericu): Alt-click behavior on links is platform-dependent and not well |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2867 Browser* browser = new Browser(params); | 2845 Browser* browser = new Browser(params); |
2868 gfx::Rect bounds = browser->window()->GetBounds(); | 2846 gfx::Rect bounds = browser->window()->GetBounds(); |
2869 | 2847 |
2870 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2848 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
2871 // See https://crbug.com/567925. | 2849 // See https://crbug.com/567925. |
2872 EXPECT_GE(bounds.width(), 100); | 2850 EXPECT_GE(bounds.width(), 100); |
2873 EXPECT_EQ(122, bounds.height()); | 2851 EXPECT_EQ(122, bounds.height()); |
2874 browser->window()->Close(); | 2852 browser->window()->Close(); |
2875 } | 2853 } |
2876 } | 2854 } |
OLD | NEW |