| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 // Select composition and do sanity check. | 1987 // Select composition and do sanity check. |
| 1988 WebVector<WebCompositionUnderline> emptyUnderlines; | 1988 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 1989 frame->setEditableSelectionOffsets(6, 6); | 1989 frame->setEditableSelectionOffsets(6, 6); |
| 1990 EXPECT_TRUE(webView->setComposition("fghij", emptyUnderlines, 0, 5)); | 1990 EXPECT_TRUE(webView->setComposition("fghij", emptyUnderlines, 0, 5)); |
| 1991 frame->setEditableSelectionOffsets(11, 11); | 1991 frame->setEditableSelectionOffsets(11, 11); |
| 1992 verifySelectionAndComposition(webView, 11, 11, 6, 11, "initial case"); | 1992 verifySelectionAndComposition(webView, 11, 11, 6, 11, "initial case"); |
| 1993 | 1993 |
| 1994 // Press Backspace and verify composition didn't get cancelled. This is
to verify the fix | 1994 // Press Backspace and verify composition didn't get cancelled. This is
to verify the fix |
| 1995 // for crbug.com/429916. | 1995 // for crbug.com/429916. |
| 1996 WebKeyboardEvent keyEvent; | 1996 WebKeyboardEvent keyEvent; |
| 1997 keyEvent.domKey = Platform::current()->domKeyEnumFromString("\b"); |
| 1997 keyEvent.windowsKeyCode = VKEY_BACK; | 1998 keyEvent.windowsKeyCode = VKEY_BACK; |
| 1998 keyEvent.setKeyIdentifierFromWindowsKeyCode(); | 1999 keyEvent.setKeyIdentifierFromWindowsKeyCode(); |
| 1999 keyEvent.type = WebInputEvent::RawKeyDown; | 2000 keyEvent.type = WebInputEvent::RawKeyDown; |
| 2000 webView->handleInputEvent(keyEvent); | 2001 webView->handleInputEvent(keyEvent); |
| 2001 | 2002 |
| 2002 frame->setEditableSelectionOffsets(6, 6); | 2003 frame->setEditableSelectionOffsets(6, 6); |
| 2003 EXPECT_TRUE(webView->setComposition("fghi", emptyUnderlines, 0, 4)); | 2004 EXPECT_TRUE(webView->setComposition("fghi", emptyUnderlines, 0, 4)); |
| 2004 frame->setEditableSelectionOffsets(10, 10); | 2005 frame->setEditableSelectionOffsets(10, 10); |
| 2005 verifySelectionAndComposition(webView, 10, 10, 6, 10, "after pressing Ba
ckspace"); | 2006 verifySelectionAndComposition(webView, 10, 10, 6, 10, "after pressing Ba
ckspace"); |
| 2006 | 2007 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2169 | 2170 |
| 2170 WebElement element = webView->mainFrame()->document().getElementById("messag
e"); | 2171 WebElement element = webView->mainFrame()->document().getElementById("messag
e"); |
| 2171 EXPECT_STREQ("DOMFocusOutDOMFocusIn", element.textContent().utf8().data()); | 2172 EXPECT_STREQ("DOMFocusOutDOMFocusIn", element.textContent().utf8().data()); |
| 2172 } | 2173 } |
| 2173 | 2174 |
| 2174 static void openDateTimeChooser(WebView* webView, HTMLInputElement* inputElement
) | 2175 static void openDateTimeChooser(WebView* webView, HTMLInputElement* inputElement
) |
| 2175 { | 2176 { |
| 2176 inputElement->focus(); | 2177 inputElement->focus(); |
| 2177 | 2178 |
| 2178 WebKeyboardEvent keyEvent; | 2179 WebKeyboardEvent keyEvent; |
| 2180 keyEvent.domKey = Platform::current()->domKeyEnumFromString(" "); |
| 2179 keyEvent.windowsKeyCode = VKEY_SPACE; | 2181 keyEvent.windowsKeyCode = VKEY_SPACE; |
| 2180 keyEvent.type = WebInputEvent::RawKeyDown; | 2182 keyEvent.type = WebInputEvent::RawKeyDown; |
| 2181 keyEvent.setKeyIdentifierFromWindowsKeyCode(); | 2183 keyEvent.setKeyIdentifierFromWindowsKeyCode(); |
| 2182 webView->handleInputEvent(keyEvent); | 2184 webView->handleInputEvent(keyEvent); |
| 2183 | 2185 |
| 2184 keyEvent.type = WebInputEvent::KeyUp; | 2186 keyEvent.type = WebInputEvent::KeyUp; |
| 2185 webView->handleInputEvent(keyEvent); | 2187 webView->handleInputEvent(keyEvent); |
| 2186 } | 2188 } |
| 2187 | 2189 |
| 2188 // TODO(crbug.com/605112) This test is crashing on Android (Nexus 4) bot. | 2190 // TODO(crbug.com/605112) This test is crashing on Android (Nexus 4) bot. |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2797 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("form.html")); | 2799 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("form.html")); |
| 2798 MockAutofillClient client; | 2800 MockAutofillClient client; |
| 2799 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html"
, true); | 2801 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html"
, true); |
| 2800 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | 2802 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 2801 frame->setAutofillClient(&client); | 2803 frame->setAutofillClient(&client); |
| 2802 webView->setInitialFocus(false); | 2804 webView->setInitialFocus(false); |
| 2803 | 2805 |
| 2804 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); | 2806 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); |
| 2805 | 2807 |
| 2806 WebKeyboardEvent keyEvent; | 2808 WebKeyboardEvent keyEvent; |
| 2809 keyEvent.domKey = Platform::current()->domKeyEnumFromString(" "); |
| 2807 keyEvent.windowsKeyCode = VKEY_SPACE; | 2810 keyEvent.windowsKeyCode = VKEY_SPACE; |
| 2808 keyEvent.type = WebInputEvent::RawKeyDown; | 2811 keyEvent.type = WebInputEvent::RawKeyDown; |
| 2809 keyEvent.setKeyIdentifierFromWindowsKeyCode(); | 2812 keyEvent.setKeyIdentifierFromWindowsKeyCode(); |
| 2810 webView->handleInputEvent(keyEvent); | 2813 webView->handleInputEvent(keyEvent); |
| 2811 keyEvent.type = WebInputEvent::KeyUp; | 2814 keyEvent.type = WebInputEvent::KeyUp; |
| 2812 webView->handleInputEvent(keyEvent); | 2815 webView->handleInputEvent(keyEvent); |
| 2813 | 2816 |
| 2814 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); | 2817 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); |
| 2815 frame->setAutofillClient(0); | 2818 frame->setAutofillClient(0); |
| 2816 } | 2819 } |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3181 frame->setAutofillClient(&client); | 3184 frame->setAutofillClient(&client); |
| 3182 webView->setInitialFocus(false); | 3185 webView->setInitialFocus(false); |
| 3183 | 3186 |
| 3184 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3187 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
| 3185 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3188 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
| 3186 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3189 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 3187 frame->setAutofillClient(0); | 3190 frame->setAutofillClient(0); |
| 3188 } | 3191 } |
| 3189 | 3192 |
| 3190 } // namespace blink | 3193 } // namespace blink |
| OLD | NEW |