Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebDriver: Add headers for Input State and Input Source #1333

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

noahmbright
Copy link
Contributor

For issue #1040

Endpoints 15.7 and 15.8 require input state and some associated state around that. This starts to implement that and get some scaffolding around those endpoints

@noahmbright noahmbright force-pushed the webdriver_actions branch 2 times, most recently from dad5765 to 391609c Compare September 9, 2024 12:21
Copy link
Member

@AtkinsSJ AtkinsSJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! It's great to have someone tackling this. :^)

I have left rather a lot of comments. 😅 Some are just the same thing in multiple places.

A few more general issues:

  • This is all currently "dead code" - nothing uses it. We like all code to be used by something so that we know it works, even if it's just a stub that prints a debug message. I guess this was waiting on WebDriver: Add boilerplate for endpoint 15.7 Perform Actions #1261, but now that's merged you should be able to rebase this branch and start building on that.
  • Please read the Coding Style document, and run clang-format on your changes before submitting them. There are a few naming convention and formatting issues here.
  • When adding functions/methods/constructors etc, generally the code for them should go in a .cpp file with the same name. (You'll then need to add that .cpp file to the cmake files so it can compile it. Look for a file named CMakeLists.txt in a parent directory, or you can search for a different .cpp file's name and see which one mentions it.) I can see several places here where you've declared a function, and then not implemented it. Please make sure there's an implementation, even if it's just a stub function that just logs a debug message.
  • I think both these headers look like they'd fit better in Libraries/LibWeb/WebDriver, but I'm not an expert on WebDriver so I could be wrong. Maybe wait for someone else's opinion on that. (cc @trflynn89?)

Userland/Services/WebContent/InputSource.h Outdated Show resolved Hide resolved
Userland/Services/WebContent/InputSource.h Outdated Show resolved Hide resolved
Userland/Services/WebContent/InputState.h Outdated Show resolved Hide resolved
Userland/Services/WebContent/InputState.h Outdated Show resolved Hide resolved
Userland/Services/WebContent/InputSource.h Outdated Show resolved Hide resolved
Userland/Services/WebContent/InputSource.h Outdated Show resolved Hide resolved
Userland/Services/WebContent/InputSource.h Outdated Show resolved Hide resolved
Comment on lines 71 to 73
// FIXME: return types, arguments
void keyDown();
void keyUp();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to just not include these for now, until you know how they need to work. Same for the other "action" methods.

Comment on lines 16 to 19
// FIXME: Action object is an object, constructed with fields
// property id, type, and subtype
// this type might not express that
using ActionObject = AK::JsonObject;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we'd use a struct or class for this, but the need to set arbitrary keys and values on it makes that tricky, so this might be fine.

private:
// A map where keys are input ids, and the values are input sources.
// Input ids are UUIDs, which are strings
AK::HashMap<AK::String, NonnullOwnPtr<InputSource>> m_input_state_map;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I mentioned OwnPtrs before: Using them here is correct. 👍

Endpoints 15.7 and 15.8 require input state and some associated state
around that. This starts to implement that and get some scaffolding
around those endpoints

Make factory functions for the input sources, partially implement
get a pointer id, stub in get the input state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants