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

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 unittest to use different urls and destructor to register same url again 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..2c86b10a55bbd104eee1f5dc08feffe4091c0084 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/");
+ 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);
}
@@ -95,7 +104,7 @@ TEST(WebInputEventConversionTest, WebMouseEventBuilder)
TEST(WebInputEventConversionTest, WebTouchEventBuilder)
{
- const std::string baseURL("http://www.test0.com/");
+ const std::string baseURL("http://www.test1.com/");
const std::string fileName("fixed_layout.html");
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("fixed_layout.html"));
@@ -216,7 +225,7 @@ TEST(WebInputEventConversionTest, WebTouchEventBuilder)
TEST(WebInputEventConversionTest, InputEventsScaling)
{
- const std::string baseURL("http://www.test.com/");
+ const std::string baseURL("http://www.test2.com/");
const std::string fileName("fixed_layout.html");
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("fixed_layout.html"));
@@ -439,7 +448,7 @@ TEST(WebInputEventConversionTest, InputEventsScaling)
TEST(WebInputEventConversionTest, InputEventsTransform)
{
- const std::string baseURL("http://www.test2.com/");
+ const std::string baseURL("http://www.test3.com/");
const std::string fileName("fixed_layout.html");
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("fixed_layout.html"));
@@ -586,7 +595,7 @@ TEST(WebInputEventConversionTest, InputEventsTransform)
TEST(WebInputEventConversionTest, InputEventsConversions)
{
- const std::string baseURL("http://www.test3.com/");
+ const std::string baseURL("http://www.test4.com/");
const std::string fileName("fixed_layout.html");
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("fixed_layout.html"));
@@ -639,7 +648,7 @@ static void setupVirtualViewportPinch(WebSettings* settings)
TEST(WebInputEventConversionTest, PinchViewportOffset)
{
- const std::string baseURL("http://www.test4.com/");
+ const std::string baseURL("http://www.test5.com/");
const std::string fileName("fixed_layout.html");
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("fixed_layout.html"));
@@ -731,7 +740,7 @@ TEST(WebInputEventConversionTest, PinchViewportOffset)
TEST(WebInputEventConversionTest, WebMouseWheelEventBuilder)
{
- const std::string baseURL("http://www.test5.com/");
+ const std::string baseURL("http://www.test6.com/");
const std::string fileName("fixed_layout.html");
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("fixed_layout.html"));
@@ -762,7 +771,7 @@ TEST(WebInputEventConversionTest, WebMouseWheelEventBuilder)
TEST(WebInputEventConversionTest, PlatformWheelEventBuilder)
{
- const std::string baseURL("http://www.test6.com/");
+ const std::string baseURL("http://www.test7.com/");
const std::string fileName("fixed_layout.html");
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("fixed_layout.html"));

Powered by Google App Engine
This is Rietveld 408576698