Skip to content

Commit

Permalink
sensors: Add content_shell code path for new sensor manipulation comm…
Browse files Browse the repository at this point in the history
…ands.

content_shell does not use ChromeDriver, so we need a separate
implementation for the testdriver.js commands we are adding.

This implementation is anchored on Blink's Internals system, which then
uses Mojo to call the virtual sensor-related Mojo commands in the
SensorProvider interface. Once the calls reach content/browser, the code
path is identical to what happens via ChromeDriver and CDP.

Bug: 1278377
Change-Id: I13f49d529b36916d1f98b4792839e818fd7e8bdb
  • Loading branch information
Raphael Kubo da Costa authored and chromium-wpt-export-bot committed Sep 6, 2023
1 parent 3fbfb91 commit d08a056
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions resources/testdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,22 @@
*/
reset_fedcm_cooldown: function(context=null) {
return window.test_driver_internal.reset_fedcm_cooldown(context);
},

create_virtual_sensor: function(sensor_type, sensor_params={}, context=null) {
return window.test_driver_internal.create_virtual_sensor(sensor_type, sensor_params, context);
},

update_virtual_sensor: function(sensor_type, reading, context=null) {
return window.test_driver_internal.update_virtual_sensor(sensor_type, reading, context);
},

remove_virtual_sensor: function(sensor_type, context=null) {
return window.test_driver_internal.remove_virtual_sensor(sensor_type, context);
},

get_virtual_sensor_information: function(sensor_type, context=null) {
return window.test_driver_internal.get_virtual_sensor_information(sensor_type, context);
}
};

Expand Down Expand Up @@ -953,6 +969,22 @@

async reset_fedcm_cooldown(context=null) {
throw new Error("reset_fedcm_cooldown() is not implemented by testdriver-vendor.js");
},

async create_virtual_sensor(sensor_type, sensor_params={}, context=null) {
throw new Error("create_virtual_sensor() is not implemented by testdriver-vendor.js");
},

async update_virtual_sensor(sensor_type, reading, context=null) {
throw new Error("update_virtual_sensor() is not implemented by testdriver-vendor.js");
},

async remove_virtual_sensor(sensor_type, context=null) {
throw new Error("remove_virtual_sensor() is not implemented by testdriver-vendor.js");
},

async get_virtual_sensor_information(sensor_type, context=null) {
throw new Error("get_virtual_sensor_information() is not implemented by testdriver-vendor.js");
}
};
})();

0 comments on commit d08a056

Please sign in to comment.