| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/renderer_host/input/web_input_event_builders_mac.h" | 5 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 {kVK_Function, ui::DomKey::FN}}; | 556 {kVK_Function, ui::DomKey::FN}}; |
| 557 | 557 |
| 558 for (const DomKeyTestCase& entry : table) { | 558 for (const DomKeyTestCase& entry : table) { |
| 559 NSEvent* mac_event = | 559 NSEvent* mac_event = |
| 560 BuildFakeKeyEvent(entry.mac_key_code, 0, 0, NSFlagsChanged); | 560 BuildFakeKeyEvent(entry.mac_key_code, 0, 0, NSFlagsChanged); |
| 561 WebKeyboardEvent web_event = WebKeyboardEventBuilder::Build(mac_event); | 561 WebKeyboardEvent web_event = WebKeyboardEventBuilder::Build(mac_event); |
| 562 EXPECT_EQ(entry.dom_key, web_event.domKey) << entry.mac_key_code; | 562 EXPECT_EQ(entry.dom_key, web_event.domKey) << entry.mac_key_code; |
| 563 } | 563 } |
| 564 } | 564 } |
| 565 | 565 |
| 566 // Flaky - https://crbug.com/640457 |
| 566 // Test that a ui::Event and blink::WebInputEvent made from the same NSEvent | 567 // Test that a ui::Event and blink::WebInputEvent made from the same NSEvent |
| 567 // have the same values for comparable fields. | 568 // have the same values for comparable fields. |
| 568 TEST(WebInputEventBuilderMacTest, ScrollWheelMatchesUIEvent) { | 569 TEST(WebInputEventBuilderMacTest, DISABLED_ScrollWheelMatchesUIEvent) { |
| 569 CGFloat delta_x = 123; | 570 CGFloat delta_x = 123; |
| 570 CGFloat delta_y = 321; | 571 CGFloat delta_y = 321; |
| 571 NSPoint location = NSMakePoint(11, 22); | 572 NSPoint location = NSMakePoint(11, 22); |
| 572 | 573 |
| 573 // WebMouseWheelEventBuilder requires a non-nil view to map coordinates. So | 574 // WebMouseWheelEventBuilder requires a non-nil view to map coordinates. So |
| 574 // create a dummy window, but don't show it. It will be released when closed. | 575 // create a dummy window, but don't show it. It will be released when closed. |
| 575 NSWindow* window = | 576 NSWindow* window = |
| 576 [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100) | 577 [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100) |
| 577 styleMask:NSBorderlessWindowMask | 578 styleMask:NSBorderlessWindowMask |
| 578 backing:NSBackingStoreBuffered | 579 backing:NSBackingStoreBuffered |
| (...skipping 14 matching lines...) Expand all Loading... |
| 593 EXPECT_EQ(web_event.deltaY, ui_event.y_offset()); | 594 EXPECT_EQ(web_event.deltaY, ui_event.y_offset()); |
| 594 | 595 |
| 595 EXPECT_EQ(11, web_event.x); | 596 EXPECT_EQ(11, web_event.x); |
| 596 EXPECT_EQ(web_event.x, ui_event.x()); | 597 EXPECT_EQ(web_event.x, ui_event.x()); |
| 597 | 598 |
| 598 // Both ui:: and blink:: events use an origin at the top-left. | 599 // Both ui:: and blink:: events use an origin at the top-left. |
| 599 EXPECT_EQ(100 - 22, web_event.y); | 600 EXPECT_EQ(100 - 22, web_event.y); |
| 600 EXPECT_EQ(web_event.y, ui_event.y()); | 601 EXPECT_EQ(web_event.y, ui_event.y()); |
| 601 [window close]; | 602 [window close]; |
| 602 } | 603 } |
| OLD | NEW |