Diagnostics: add Assistant key field for keyboards
or external ones Bug: 1207678 Test: check field is true for Eve's keyboard, but not Morphius, Sarien, Change-Id: Id862021421ab7cc3b493253eafbc8294ba8a570f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2971519 Commit-Queue: Harry Cutts <hcutts@chromium.org> Reviewed-by: Chris Palmer <palmer@chromium.org> Reviewed-by: Joon Ahn <joonbug@chromium.org> Cr-Commit-Position: refs/heads/master@{#894373}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
7988d9b38a
commit
ec22a3055a
chrome/test/data/webui/chromeos/diagnostics
chromeos/components/diagnostics_ui
backend
mojom
resources
ui/events/ozone/evdev
@ -67,6 +67,7 @@ export function inputListTestSuite() {
|
||||
connectionType: ConnectionType.kUsb,
|
||||
name: 'Sample USB keyboard',
|
||||
physicalLayout: PhysicalLayout.kUnknown,
|
||||
hasAssistantKey: false,
|
||||
};
|
||||
return initializeInputList()
|
||||
.then(() => {
|
||||
|
@ -194,6 +194,8 @@ void InputDataProvider::AddKeyboard(int id,
|
||||
// and Dell KM713 Chrome keyboard.
|
||||
}
|
||||
|
||||
keyboards_[id]->has_assistant_key = device_info->HasKeyEvent(KEY_ASSISTANT);
|
||||
|
||||
for (auto& observer : connected_devices_observers_) {
|
||||
observer->OnKeyboardConnected(keyboards_[id]->Clone());
|
||||
}
|
||||
|
@ -81,6 +81,8 @@ class TestInputDataProvider : public InputDataProvider {
|
||||
device_caps = ui::kHpUsbKeyboard;
|
||||
} else if (base_name == "event5") {
|
||||
device_caps = ui::kSarienKeyboard;
|
||||
} else if (base_name == "event6") {
|
||||
device_caps = ui::kEveKeyboard;
|
||||
}
|
||||
|
||||
EXPECT_TRUE(ui::CapabilitiesToDeviceInfo(device_caps, dev_info.get()));
|
||||
@ -268,6 +270,31 @@ TEST_F(InputDataProviderTest, KeyboardPhysicalLayoutDetection) {
|
||||
run_loop.Run();
|
||||
}
|
||||
|
||||
TEST_F(InputDataProviderTest, KeyboardAssistantKeyDetection) {
|
||||
base::RunLoop run_loop;
|
||||
ui::DeviceEvent link_event(ui::DeviceEvent::DeviceType::INPUT,
|
||||
ui::DeviceEvent::ActionType::ADD,
|
||||
base::FilePath("/dev/input/event0"));
|
||||
ui::DeviceEvent eve_event(ui::DeviceEvent::DeviceType::INPUT,
|
||||
ui::DeviceEvent::ActionType::ADD,
|
||||
base::FilePath("/dev/input/event6"));
|
||||
provider_->OnDeviceEvent(link_event);
|
||||
provider_->OnDeviceEvent(eve_event);
|
||||
|
||||
provider_->GetConnectedDevices(base::BindLambdaForTesting(
|
||||
[&](std::vector<mojom::KeyboardInfoPtr> keyboards,
|
||||
std::vector<mojom::TouchDeviceInfoPtr> touch_devices) {
|
||||
EXPECT_EQ(2ul, keyboards.size());
|
||||
|
||||
mojom::KeyboardInfoPtr link_keyboard = keyboards[0].Clone();
|
||||
EXPECT_EQ(0u, link_keyboard->id);
|
||||
EXPECT_FALSE(link_keyboard->has_assistant_key);
|
||||
mojom::KeyboardInfoPtr eve_keyboard = keyboards[1].Clone();
|
||||
EXPECT_EQ(6u, eve_keyboard->id);
|
||||
EXPECT_TRUE(eve_keyboard->has_assistant_key);
|
||||
}));
|
||||
}
|
||||
|
||||
TEST_F(InputDataProviderTest, ObserveConnectedDevices_Keyboards) {
|
||||
FakeConnectedDevicesObserver fake_observer;
|
||||
provider_->ObserveConnectedDevices(
|
||||
|
@ -29,6 +29,7 @@ struct KeyboardInfo {
|
||||
ConnectionType connection_type;
|
||||
string name;
|
||||
PhysicalLayout physical_layout;
|
||||
bool has_assistant_key;
|
||||
};
|
||||
|
||||
enum TouchDeviceType {
|
||||
|
@ -3,7 +3,12 @@
|
||||
<ul id="keyboardList">
|
||||
<dom-repeat items="[[keyboards_]]" as="keyboard">
|
||||
<template>
|
||||
<li>[[keyboard.name]] ([[keyboard.physicalLayout]])</li>
|
||||
<li>
|
||||
[[keyboard.name]] ([[keyboard.physicalLayout]])
|
||||
<template is="dom-if" if="[[keyboard.hasAssistantKey]]">
|
||||
(with Assistant key)
|
||||
</template>
|
||||
</li>
|
||||
</template>
|
||||
</dom-repeat>
|
||||
</ul>
|
||||
|
@ -1110,6 +1110,29 @@ const DeviceCapabilities kDrawciaStylusGarage = {
|
||||
/* ff */ "0",
|
||||
};
|
||||
|
||||
// The built-in keyboard for Eve, which has an Assistant key.
|
||||
const DeviceCapabilities kEveKeyboard = {
|
||||
/* path */ "/sys/devices/platform/i8042/serio0/input/input3/event3",
|
||||
/* name */ "AT Translated Set 2 keyboard",
|
||||
/* phys */ "isa0060/serio0/input0",
|
||||
/* uniq */ "",
|
||||
/* bustype */ "0011",
|
||||
/* vendor */ "0001",
|
||||
/* product */ "0001",
|
||||
/* version */ "ab83",
|
||||
/* prop */ "0",
|
||||
/* ev */ "120013",
|
||||
/* key */
|
||||
"88 0 0 0 0 0 402000000 3003078f800d001 feffffdfffefffff "
|
||||
"fffffffffffffffe",
|
||||
/* rel */ "0",
|
||||
/* abs */ "0",
|
||||
/* msc */ "10",
|
||||
/* sw */ "0",
|
||||
/* led */ "7",
|
||||
/* ff */ "0",
|
||||
};
|
||||
|
||||
// The built-in keyboard on Sarien, which has a few more keys than normal.
|
||||
const DeviceCapabilities kSarienKeyboard = {
|
||||
/* path */ "/sys/devices/platform/i8042/serio0/input/input2/event2",
|
||||
|
@ -93,6 +93,7 @@ extern const DeviceCapabilities kDrallionStylus;
|
||||
extern const DeviceCapabilities kDellActivePenButton;
|
||||
extern const DeviceCapabilities kPuffMicrophoneMuteSwitch;
|
||||
extern const DeviceCapabilities kDrawciaStylusGarage;
|
||||
extern const DeviceCapabilities kEveKeyboard;
|
||||
extern const DeviceCapabilities kSarienKeyboard;
|
||||
} // namspace ui
|
||||
|
||||
|
Reference in New Issue
Block a user