Open Bug 1679108 Opened 4 years ago Updated 3 months ago

[GTK] Create a framework to test IMContextWrapper

Categories

(Core :: DOM: UI Events & Focus Handling, task, P3)

Desktop
Linux
task

Tracking

()

ASSIGNED

People

(Reporter: masayuki, Assigned: masayuki)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

(Keywords: inputmethod)

Attachments

(3 files)

IMContextWrapper does really hacky things for handling asynchronous ibus and fcitx's hacky OOP IMEs. For making the maintenance safer, we should have a framework for testing it.

Type: enhancement → task
Assignee: nobody → masayuki
Status: NEW → ASSIGNED

For making API calls and signal listeners are iteruptible, we need to stop
accessing native API directly. This patch creates GtkIMContextProxy
class which wraps a GtkIMContext instance and hides it from its users.

My idea of the new test framework is, JS class can implement a emulator
of GtkIMContext and API calls with it. In other words, the class is
created per GtkIMContext and can listen to all API calls for it.

For implementing the class, this patch adds nsIGtkIMContextEmulator
which has methods which are called when GtkIMContextProxy calls an
API.

Additionally, the tests (assuming mochitest-chrome) need to synthesize
native events. For making it possible, this patch adds
nsIGtkIMETester too. This is impelmented as GtkIMETester with C++.

When JS attaches an emulator class via nsIDOMWindowUtils, it'll be
attached to "current" GtkIMContextProxy on the native window. And
it returns GtkIMETester instance for making the test can synthesize
native events.

Note that GtkIMETester is associated with an IMContextWrapper which
is created per native window, and it may have 3 GtkIMContextProxy
instances at most. This incosistency may be freel complicated, but
in usual tests, only one nsIGtkIMContextEmulator is required. So,
this should not be a matter.

Depends on D116445

The patches touch all over IMContextWrapper. So, if you need to touch it, my patches are perhaps broken by the change, but feel free to do it because I cannot finish following patches for them so quickly.

Attachment #9224398 - Attachment description: Bug 1679108 - part 3: Add 2 XPCOM interfaces to listen to API calls of GtkIMContextProxy and to synthesize native event on IMContextWrapper r=smaug! → Bug 1679108 - part 3: Add 2 XPCOM interfaces to listen to API calls of GtkIMContextProxy and to synthesize native event on IMContextWrapper r=smaug!,m_kato!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: