| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "public/web/WebSettings.h" | 49 #include "public/web/WebSettings.h" |
| 50 #include "testing/gtest/include/gtest/gtest.h" | 50 #include "testing/gtest/include/gtest/gtest.h" |
| 51 #include "web/WebLocalFrameImpl.h" | 51 #include "web/WebLocalFrameImpl.h" |
| 52 #include "web/WebViewImpl.h" | 52 #include "web/WebViewImpl.h" |
| 53 #include "web/tests/FrameTestHelpers.h" | 53 #include "web/tests/FrameTestHelpers.h" |
| 54 | 54 |
| 55 namespace blink { | 55 namespace blink { |
| 56 | 56 |
| 57 KeyboardEvent* createKeyboardEventWithLocation( | 57 KeyboardEvent* createKeyboardEventWithLocation( |
| 58 KeyboardEvent::KeyLocationCode location) { | 58 KeyboardEvent::KeyLocationCode location) { |
| 59 return KeyboardEvent::create("keydown", true, true, 0, "", "", location, | 59 KeyboardEventInit keyEventInit; |
| 60 PlatformEvent::NoModifiers, 0); | 60 keyEventInit.setBubbles(true); |
| 61 keyEventInit.setCancelable(true); |
| 62 keyEventInit.setLocation(location); |
| 63 return new KeyboardEvent("keydown", keyEventInit); |
| 61 } | 64 } |
| 62 | 65 |
| 63 int getModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location) { | 66 int getModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location) { |
| 64 KeyboardEvent* event = createKeyboardEventWithLocation(location); | 67 KeyboardEvent* event = createKeyboardEventWithLocation(location); |
| 65 WebKeyboardEventBuilder convertedEvent(*event); | 68 WebKeyboardEventBuilder convertedEvent(*event); |
| 66 return convertedEvent.modifiers; | 69 return convertedEvent.modifiers; |
| 67 } | 70 } |
| 68 | 71 |
| 69 TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) { | 72 TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) { |
| 70 // Test key location conversion. | 73 // Test key location conversion. |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 EXPECT_EQ(ScrollInertialPhaseNonMomentum, | 1247 EXPECT_EQ(ScrollInertialPhaseNonMomentum, |
| 1245 platformGestureBuilder.inertialPhase()); | 1248 platformGestureBuilder.inertialPhase()); |
| 1246 EXPECT_TRUE(platformGestureBuilder.synthetic()); | 1249 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
| 1247 EXPECT_EQ(ScrollGranularity::ScrollByPage, | 1250 EXPECT_EQ(ScrollGranularity::ScrollByPage, |
| 1248 platformGestureBuilder.deltaUnits()); | 1251 platformGestureBuilder.deltaUnits()); |
| 1249 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); | 1252 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); |
| 1250 } | 1253 } |
| 1251 } | 1254 } |
| 1252 | 1255 |
| 1253 } // namespace blink | 1256 } // namespace blink |
| OLD | NEW |