| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 WebKit::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::DOMKe
yLocationStandard); | 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::DOMKeyLoc
ationLeft); | 73 modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_L
OCATION_LEFT); |
| 74 EXPECT_TRUE(modifiers & WebInputEvent::IsLeft); | 74 EXPECT_TRUE(modifiers & WebInputEvent::IsLeft); |
| 75 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsRight); | 75 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsRight); |
| 76 | 76 |
| 77 modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOMKeyLoc
ationRight); | 77 modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_L
OCATION_RIGHT); |
| 78 EXPECT_TRUE(modifiers & WebInputEvent::IsRight); | 78 EXPECT_TRUE(modifiers & WebInputEvent::IsRight); |
| 79 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsLeft); | 79 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsLeft); |
| 80 | 80 |
| 81 modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOMKeyLoc
ationNumpad); | 81 modifiers = getModifiersForKeyLocationCode(WebCore::KeyboardEvent::DOM_KEY_L
OCATION_NUMPAD); |
| 82 EXPECT_TRUE(modifiers & WebInputEvent::IsKeyPad); | 82 EXPECT_TRUE(modifiers & WebInputEvent::IsKeyPad); |
| 83 EXPECT_FALSE(modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent:
:IsRight); | 83 EXPECT_FALSE(modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent:
:IsRight); |
| 84 } | 84 } |
| 85 | 85 |
| 86 TEST(WebInputEventConversionTest, WebTouchEventBuilder) | 86 TEST(WebInputEventConversionTest, WebTouchEventBuilder) |
| 87 { | 87 { |
| 88 RefPtr<WebCore::TouchEvent> event = WebCore::TouchEvent::create(); | 88 RefPtr<WebCore::TouchEvent> event = WebCore::TouchEvent::create(); |
| 89 WebMouseEventBuilder mouse(0, 0, *event); | 89 WebMouseEventBuilder mouse(0, 0, *event); |
| 90 EXPECT_EQ(WebInputEvent::Undefined, mouse.type); | 90 EXPECT_EQ(WebInputEvent::Undefined, mouse.type); |
| 91 } | 91 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 EXPECT_EQ(10, webTouchBuilder.touches[0].position.x); | 275 EXPECT_EQ(10, webTouchBuilder.touches[0].position.x); |
| 276 EXPECT_EQ(10, webTouchBuilder.touches[0].position.y); | 276 EXPECT_EQ(10, webTouchBuilder.touches[0].position.y); |
| 277 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusX); | 277 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusX); |
| 278 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusY); | 278 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusY); |
| 279 } | 279 } |
| 280 | 280 |
| 281 webViewImpl->close(); | 281 webViewImpl->close(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } // anonymous namespace | 284 } // anonymous namespace |
| OLD | NEW |