WebKit Bugzilla
Attachment 340245 Details for
Bug 185577
: WebDriver: W3C test case actions/key.py::test_lone_keyup_sends_no_events is failing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185577-20180511222025.patch (text/plain), 13.15 KB, created by
BJ Burg
on 2018-05-11 22:20:26 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
BJ Burg
Created:
2018-05-11 22:20:26 PDT
Size:
13.15 KB
patch
obsolete
>Subversion Revision: 231727 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index bf6def710a0abaadfc9e8fd2ebf3240eb7f58bd1..9bd4ca41f5593f55cb37000b18ca7040bea22592 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,41 @@ >+2018-05-11 Brian Burg <bburg@apple.com> >+ >+ WebDriver: W3C test case actions/key.py::test_lone_keyup_sends_no_events is failing >+ https://bugs.webkit.org/show_bug.cgi?id=185577 >+ <rdar://problem/40185478> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This test is failing because it expects Release Actions to not emit any >+ events if nothing has changed from the initial state. Because the two code paths >+ for creating empty states don't actually produce the same empty state, a difference >+ in location was detected between the two empty states. This generates a mousemove. >+ >+ To fix this, unify the code that creates an empty state. For mouse input sources, always >+ initialize the location to (0, 0) so that the mouse input source always has >+ a location that is valid to click at. >+ >+ * UIProcess/Automation/SimulatedInputDispatcher.h: >+ Extract the type enum out of the class to avoid circular definitions of >+ SimulatedInputSource and SimulatedInputSourceState. >+ >+ * UIProcess/Automation/SimulatedInputDispatcher.cpp: >+ (WebKit::SimulatedInputSourceState::emptyStateForSourceType): >+ Take the input source type when generating an empty state. We always want location >+ set for a mouse input source, but not set it for other input sources like keys. >+ >+ (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): >+ (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): >+ (WebKit::SimulatedInputSource::create): >+ (WebKit::SimulatedInputSource::SimulatedInputSource): >+ (WebKit::SimulatedInputSourceState::emptyState): Deleted. >+ * UIProcess/Automation/WebAutomationSession.cpp: >+ (WebKit::WebAutomationSession::WebAutomationSession): >+ (WebKit::WebAutomationSession::inputSourceForType const): >+ (WebKit::simulatedInputSourceTypeFromProtocolSourceType): >+ (WebKit::WebAutomationSession::performInteractionSequence): >+ * UIProcess/Automation/WebAutomationSession.h: >+ > 2018-05-11 Megan Gardner <megan_gardner@apple.com> > > Cleanup canPerformActionForWebView in relation to the webSelectionAssistant being removed >diff --git a/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp b/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp >index f47174ba0fc53ac56aa3a559d4eda547c7d94743..912118ce2263fb449482faa451c4e662f11d4809 100644 >--- a/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp >+++ b/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp >@@ -32,6 +32,22 @@ > > namespace WebKit { > >+SimulatedInputSourceState SimulatedInputSourceState::emptyStateForSourceType(SimulatedInputSourceType type) >+{ >+ SimulatedInputSourceState result { }; >+ switch (type) { >+ case SimulatedInputSourceType::Null: >+ case SimulatedInputSourceType::Keyboard: >+ break; >+ case SimulatedInputSourceType::Mouse: >+ case SimulatedInputSourceType::Touch: >+ result.location = WebCore::IntPoint(); >+ } >+ >+ return result; >+} >+ >+ > SimulatedInputKeyFrame::SimulatedInputKeyFrame(Vector<StateEntry>&& entries) > : states(WTFMove(entries)) > { >@@ -66,12 +82,8 @@ SimulatedInputKeyFrame SimulatedInputKeyFrame::keyFrameToResetInputSources(HashS > Vector<SimulatedInputKeyFrame::StateEntry> entries; > entries.reserveCapacity(inputSources.size()); > >- for (auto& inputSource : inputSources) { >- auto emptyState = SimulatedInputSourceState::emptyState(); >- // Ensure we reset the location. >- emptyState.location = WebCore::IntPoint(); >- entries.uncheckedAppend(std::pair<SimulatedInputSource&, SimulatedInputSourceState> { inputSource.get(), WTFMove(emptyState) }); >- } >+ for (auto& inputSource : inputSources) >+ entries.uncheckedAppend(std::pair<SimulatedInputSource&, SimulatedInputSourceState> { inputSource.get(), SimulatedInputSourceState::emptyStateForSourceType(inputSource->type) }); > > return SimulatedInputKeyFrame(WTFMove(entries)); > } >@@ -228,11 +240,11 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource > }; > > switch (inputSource.type) { >- case SimulatedInputSource::Type::Null: >+ case SimulatedInputSourceType::Null: > // The maximum duration is handled at the keyframe level by m_keyFrameTransitionDurationTimer. > eventDispatchFinished(std::nullopt); > break; >- case SimulatedInputSource::Type::Mouse: { >+ case SimulatedInputSourceType::Mouse: { > resolveLocation(a.location.value_or(WebCore::IntPoint()), b.location, b.origin.value_or(MouseMoveOrigin::Viewport), b.nodeHandle, [this, &a, &b, eventDispatchFinished = WTFMove(eventDispatchFinished)](std::optional<WebCore::IntPoint> location, std::optional<AutomationCommandError> error) mutable { > if (error) { > eventDispatchFinished(error); >@@ -253,7 +265,7 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource > }); > break; > } >- case SimulatedInputSource::Type::Keyboard: >+ case SimulatedInputSourceType::Keyboard: > // The "dispatch a key{Down,Up} action" algorithms (§17.4 Dispatching Actions). > if ((!a.pressedCharKey && b.pressedCharKey) || (!a.pressedVirtualKey && b.pressedVirtualKey)) > m_client.simulateKeyboardInteraction(m_page, KeyboardInteraction::KeyPress, b.pressedVirtualKey, b.pressedCharKey, WTFMove(eventDispatchFinished)); >@@ -262,7 +274,7 @@ void SimulatedInputDispatcher::transitionInputSourceToState(SimulatedInputSource > else > eventDispatchFinished(std::nullopt); > break; >- case SimulatedInputSource::Type::Touch: >+ case SimulatedInputSourceType::Touch: > // Not supported yet. > ASSERT_NOT_REACHED(); > eventDispatchFinished(AUTOMATION_COMMAND_ERROR_WITH_NAME(NotImplemented)); >diff --git a/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h b/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h >index d04cdde14cf9992d058057924265e15f5edad5c2..e451ebbee2ee6bbf19b2cb29dbdb07c293798884 100644 >--- a/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h >+++ b/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h >@@ -57,6 +57,13 @@ using MouseButton = WebMouseEvent::Button; > using MouseInteraction = Inspector::Protocol::Automation::MouseInteraction; > using MouseMoveOrigin = Inspector::Protocol::Automation::MouseMoveOrigin; > >+enum class SimulatedInputSourceType { >+ Null, // Used to induce a minimum duration. >+ Keyboard, >+ Mouse, >+ Touch, >+}; >+ > struct SimulatedInputSourceState { > std::optional<CharKey> pressedCharKey; > std::optional<VirtualKey> pressedVirtualKey; >@@ -66,32 +73,25 @@ struct SimulatedInputSourceState { > std::optional<WebCore::IntPoint> location; > std::optional<Seconds> duration; > >- static SimulatedInputSourceState emptyState() { return SimulatedInputSourceState(); } >+ static SimulatedInputSourceState emptyStateForSourceType(SimulatedInputSourceType); > }; > > struct SimulatedInputSource : public RefCounted<SimulatedInputSource> { > public: >- enum class Type { >- Null, // Used to induce a minimum duration. >- Keyboard, >- Mouse, >- Touch, >- }; >- >- Type type; >+ SimulatedInputSourceType type; > > // The last state associated with this input source. > SimulatedInputSourceState state; > >- static Ref<SimulatedInputSource> create(Type type) >+ static Ref<SimulatedInputSource> create(SimulatedInputSourceType type) > { > return adoptRef(*new SimulatedInputSource(type)); > } > > private: >- SimulatedInputSource(Type type) >+ SimulatedInputSource(SimulatedInputSourceType type) > : type(type) >- , state(SimulatedInputSourceState::emptyState()) >+ , state(SimulatedInputSourceState::emptyStateForSourceType(type)) > { } > }; > >diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >index 83c9fc2f9b24f84fc3cb506b5857f5a2d974110f..b9b4ddc7e91d2b53d303275a55157209de2b8a09 100644 >--- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >+++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >@@ -78,9 +78,9 @@ WebAutomationSession::WebAutomationSession() > , m_loadTimer(RunLoop::main(), this, &WebAutomationSession::loadTimerFired) > { > // Set up canonical input sources to be used for 'performInteractionSequence' and 'cancelInteractionSequence'. >- m_inputSources.add(SimulatedInputSource::create(SimulatedInputSource::Type::Mouse)); >- m_inputSources.add(SimulatedInputSource::create(SimulatedInputSource::Type::Keyboard)); >- m_inputSources.add(SimulatedInputSource::create(SimulatedInputSource::Type::Null)); >+ m_inputSources.add(SimulatedInputSource::create(SimulatedInputSourceType::Mouse)); >+ m_inputSources.add(SimulatedInputSource::create(SimulatedInputSourceType::Keyboard)); >+ m_inputSources.add(SimulatedInputSource::create(SimulatedInputSourceType::Null)); > } > > WebAutomationSession::~WebAutomationSession() >@@ -1404,7 +1404,7 @@ SimulatedInputDispatcher& WebAutomationSession::inputDispatcherForPage(WebPagePr > }).iterator->value; > } > >-SimulatedInputSource* WebAutomationSession::inputSourceForType(SimulatedInputSource::Type type) const >+SimulatedInputSource* WebAutomationSession::inputSourceForType(SimulatedInputSourceType type) const > { > // FIXME: this should use something like Vector's findMatching(). > for (auto& inputSource : m_inputSources) { >@@ -1668,17 +1668,17 @@ void WebAutomationSession::performKeyboardInteractions(const String& handle, con > } > > #if USE(APPKIT) || PLATFORM(GTK) >-static SimulatedInputSource::Type simulatedInputSourceTypeFromProtocolSourceType(Inspector::Protocol::Automation::InputSourceType protocolType) >+static SimulatedInputSourceType simulatedInputSourceTypeFromProtocolSourceType(Inspector::Protocol::Automation::InputSourceType protocolType) > { > switch (protocolType) { > case Inspector::Protocol::Automation::InputSourceType::Null: >- return SimulatedInputSource::Type::Null; >+ return SimulatedInputSourceType::Null; > case Inspector::Protocol::Automation::InputSourceType::Keyboard: >- return SimulatedInputSource::Type::Keyboard; >+ return SimulatedInputSourceType::Keyboard; > case Inspector::Protocol::Automation::InputSourceType::Mouse: >- return SimulatedInputSource::Type::Mouse; >+ return SimulatedInputSourceType::Mouse; > case Inspector::Protocol::Automation::InputSourceType::Touch: >- return SimulatedInputSource::Type::Touch; >+ return SimulatedInputSourceType::Touch; > } > > RELEASE_ASSERT_NOT_REACHED(); >@@ -1701,7 +1701,7 @@ void WebAutomationSession::performInteractionSequence(const String& handle, cons > ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); > > HashMap<String, Ref<SimulatedInputSource>> sourceIdToInputSourceMap; >- HashMap<SimulatedInputSource::Type, String, WTF::IntHash<SimulatedInputSource::Type>, WTF::StrongEnumHashTraits<SimulatedInputSource::Type>> typeToSourceIdMap; >+ HashMap<SimulatedInputSourceType, String, WTF::IntHash<SimulatedInputSourceType>, WTF::StrongEnumHashTraits<SimulatedInputSourceType>> typeToSourceIdMap; > > // Parse and validate Automation protocol arguments. By this point, the driver has > // already performed the steps in §17.3 Processing Actions Requests. >@@ -1725,8 +1725,8 @@ void WebAutomationSession::performInteractionSequence(const String& handle, cons > if (!parsedInputSourceType) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "An input source in the 'inputSources' parameter has an invalid 'sourceType'."); > >- SimulatedInputSource::Type inputSourceType = simulatedInputSourceTypeFromProtocolSourceType(*parsedInputSourceType); >- if (inputSourceType == SimulatedInputSource::Type::Touch) >+ SimulatedInputSourceType inputSourceType = simulatedInputSourceTypeFromProtocolSourceType(*parsedInputSourceType); >+ if (inputSourceType == SimulatedInputSourceType::Touch) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(NotImplemented, "Touch input sources are not yet supported."); > > if (typeToSourceIdMap.contains(inputSourceType)) >diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.h b/Source/WebKit/UIProcess/Automation/WebAutomationSession.h >index bd24ddc420089595780134cb086cb63fdf7abe9c..3ffe3b316a7abe7bf52f5037d668eb6e9516191f 100644 >--- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.h >+++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.h >@@ -188,7 +188,7 @@ public: > // Event Simulation Support. > bool isSimulatingUserInteraction() const; > SimulatedInputDispatcher& inputDispatcherForPage(WebPageProxy&); >- SimulatedInputSource* inputSourceForType(SimulatedInputSource::Type) const; >+ SimulatedInputSource* inputSourceForType(SimulatedInputSourceType) const; > > #if PLATFORM(MAC) > bool wasEventSynthesizedForAutomation(NSEvent *);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185577
: 340245