Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2601)

Unified Diff: Source/web/tests/WebInputEventConversionTest.cpp

Issue 663523002: Adding support for DOM3 KeyboardEvents Code in KeyboardEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: "Updated test for keypress and keyup. Added DOM3 code attribute as runtime enabled feature. DOMcode… Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/tests/WebInputEventConversionTest.cpp
diff --git a/Source/web/tests/WebInputEventConversionTest.cpp b/Source/web/tests/WebInputEventConversionTest.cpp
index fa506bcd4c0578ea5fc6d718c8d50c630f6b3c6f..2f643b423b7e77a2612a481de4a9d80a73d5e924 100644
--- a/Source/web/tests/WebInputEventConversionTest.cpp
+++ b/Source/web/tests/WebInputEventConversionTest.cpp
@@ -57,31 +57,40 @@ namespace {
PassRefPtrWillBeRawPtr<KeyboardEvent> createKeyboardEventWithLocation(KeyboardEvent::KeyLocationCode location)
{
- return KeyboardEvent::create("keydown", true, true, 0, "", location, false, false, false, false);
+ return KeyboardEvent::create("keydown", true, true, 0, "", "", location, false, false, false, false);
}
-int getModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location)
+int getModifiersForKeyLocationCode(WebViewImpl* webViewImpl, KeyboardEvent::KeyLocationCode location)
{
RefPtrWillBeRawPtr<KeyboardEvent> event = createKeyboardEventWithLocation(location);
- WebKeyboardEventBuilder convertedEvent(*event);
+ WebKeyboardEventBuilder convertedEvent(toLocalFrame(webViewImpl->page()->mainFrame())->view(), *event);
return convertedEvent.modifiers;
}
TEST(WebInputEventConversionTest, WebKeyboardEventBuilder)
{
+ const std::string baseURL("http://www.test0.com/");
bokan 2015/01/23 15:35:25 I seem to recall this test file failing recently b
Habib Virji 2015/01/23 15:58:16 Have added all test to have URL in sequential orde
+ const std::string fileName("fixed_layout.html");
+
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str()));
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileName, true);
+ webViewImpl->resize(WebSize(680, 480));
+ webViewImpl->layout();
+
// Test key location conversion.
- int modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_STANDARD);
+ int modifiers = getModifiersForKeyLocationCode(webViewImpl, KeyboardEvent::DOM_KEY_LOCATION_STANDARD);
EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent::IsRight);
- modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_LEFT);
+ modifiers = getModifiersForKeyLocationCode(webViewImpl, KeyboardEvent::DOM_KEY_LOCATION_LEFT);
EXPECT_TRUE(modifiers & WebInputEvent::IsLeft);
EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEvent::IsRight);
- modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_RIGHT);
+ modifiers = getModifiersForKeyLocationCode(webViewImpl, KeyboardEvent::DOM_KEY_LOCATION_RIGHT);
EXPECT_TRUE(modifiers & WebInputEvent::IsRight);
EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEvent::IsLeft);
- modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_NUMPAD);
+ modifiers = getModifiersForKeyLocationCode(webViewImpl, KeyboardEvent::DOM_KEY_LOCATION_NUMPAD);
EXPECT_TRUE(modifiers & WebInputEvent::IsKeyPad);
EXPECT_FALSE(modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent::IsRight);
}

Powered by Google App Engine
This is Rietveld 408576698