| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "WebViewImpl.h" | 40 #include "WebViewImpl.h" |
| 41 #include "core/events/GestureEvent.h" | 41 #include "core/events/GestureEvent.h" |
| 42 #include "core/events/KeyboardEvent.h" | 42 #include "core/events/KeyboardEvent.h" |
| 43 #include "core/events/MouseEvent.h" | 43 #include "core/events/MouseEvent.h" |
| 44 #include "core/dom/Touch.h" | 44 #include "core/dom/Touch.h" |
| 45 #include "core/events/TouchEvent.h" | 45 #include "core/events/TouchEvent.h" |
| 46 #include "core/dom/TouchList.h" | 46 #include "core/dom/TouchList.h" |
| 47 #include "core/frame/Frame.h" | 47 #include "core/frame/Frame.h" |
| 48 #include "core/frame/FrameView.h" | 48 #include "core/frame/FrameView.h" |
| 49 | 49 |
| 50 using namespace WebKit; | 50 using namespace blink; |
| 51 using namespace WebCore; | 51 using namespace WebCore; |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 | 54 |
| 55 PassRefPtr<WebCore::KeyboardEvent> createKeyboardEventWithLocation(WebCore::Keyb
oardEvent::KeyLocationCode location) | 55 PassRefPtr<WebCore::KeyboardEvent> createKeyboardEventWithLocation(WebCore::Keyb
oardEvent::KeyLocationCode location) |
| 56 { | 56 { |
| 57 return WebCore::KeyboardEvent::create("keydown", true, true, 0, "", location
, false, false, false, false, false); | 57 return WebCore::KeyboardEvent::create("keydown", true, true, 0, "", location
, false, false, false, false, false); |
| 58 } | 58 } |
| 59 | 59 |
| 60 int getModifiersForKeyLocationCode(WebCore::KeyboardEvent::KeyLocationCode locat
ion) | 60 int getModifiersForKeyLocationCode(WebCore::KeyboardEvent::KeyLocationCode locat
ion) |
| 61 { | 61 { |
| 62 RefPtr<WebCore::KeyboardEvent> event = createKeyboardEventWithLocation(locat
ion); | 62 RefPtr<WebCore::KeyboardEvent> event = createKeyboardEventWithLocation(locat
ion); |
| 63 WebKit::WebKeyboardEventBuilder convertedEvent(*event); | 63 blink::WebKeyboardEventBuilder convertedEvent(*event); |
| 64 return convertedEvent.modifiers; | 64 return convertedEvent.modifiers; |
| 65 } | 65 } |
| 66 | 66 |
| 67 TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) | 67 TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) |
| 68 { | 68 { |
| 69 // Test key location conversion. | 69 // Test key location conversion. |
| 70 int modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_K
EY_LOCATION_STANDARD); | 70 int modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_K
EY_LOCATION_STANDARD); |
| 71 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsLeft || modifiers & WebInputEvent::IsRight); | 71 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsLeft || modifiers & WebInputEvent::IsRight); |
| 72 | 72 |
| 73 modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_L
OCATION_LEFT); | 73 modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_L
OCATION_LEFT); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); | 284 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); |
| 285 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.y); | 285 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.y); |
| 286 EXPECT_EQ(10, webTouchBuilder.touches[0].position.x); | 286 EXPECT_EQ(10, webTouchBuilder.touches[0].position.x); |
| 287 EXPECT_EQ(10, webTouchBuilder.touches[0].position.y); | 287 EXPECT_EQ(10, webTouchBuilder.touches[0].position.y); |
| 288 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusX); | 288 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusX); |
| 289 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusY); | 289 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusY); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // anonymous namespace | 293 } // anonymous namespace |
| OLD | NEW |