Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Unified Diff: third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js

Issue 2405093003: [WIP] Mojo native bindings interface.
Patch Set: fixes webui tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
diff --git a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
index 7d3c97e46cd7e60e4251b3b8b544df0de2780c12..64712d47d7e34f607b79453486b614e90677e539 100644
--- a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
+++ b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
@@ -19,11 +19,10 @@ class CallbackWrapper {
function sensor_mocks(mojo) {
return define('Generic Sensor API mocks', [
- 'mojo/public/js/core',
'mojo/public/js/bindings',
'device/generic_sensor/public/interfaces/sensor_provider.mojom',
'device/generic_sensor/public/interfaces/sensor.mojom',
- ], (core, bindings, sensor_provider, sensor) => {
+ ], (bindings, sensor_provider, sensor) => {
// Helper function that returns resolved promise with result.
function sensorResponse(success) {
@@ -45,9 +44,8 @@ function sensor_mocks(mojo) {
this.add_configuration_called_ = null;
this.remove_configuration_called_ = null;
this.active_sensor_configurations_ = [];
- let rv = core.mapBuffer(handle, offset, size,
- core.MAP_BUFFER_FLAG_NONE);
- assert_equals(rv.result, core.RESULT_OK, "Failed to map shared buffer");
+ let rv = handle.mapBuffer(offset, size);
+ assert_equals(rv.result, Mojo.RESULT_OK, "Failed to map shared buffer");
this.buffer_array_ = rv.buffer;
this.buffer_ = new Float64Array(this.buffer_array_);
this.resetBuffer();
@@ -139,7 +137,6 @@ function sensor_mocks(mojo) {
this.add_configuration_called_ = null;
this.remove_configuration_called_ = null;
this.resetBuffer();
- core.unmapBuffer(this.buffer_array_);
this.buffer_array_ = null;
this.binding_.close();
}
@@ -238,11 +235,8 @@ function sensor_mocks(mojo) {
sensor_provider.SensorInitParams.kReadBufferSizeForTests;
this.shared_buffer_size_in_bytes_ = this.reading_size_in_bytes_ *
sensor.SensorType.LAST;
- let rv =
- core.createSharedBuffer(
- this.shared_buffer_size_in_bytes_,
- core.CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE);
- assert_equals(rv.result, core.RESULT_OK, "Failed to create buffer");
+ let rv = Mojo.createSharedBuffer(this.shared_buffer_size_in_bytes_);
+ assert_equals(rv.result, Mojo.RESULT_OK, "Failed to create buffer");
this.shared_buffer_handle_ = rv.handle;
this.active_sensor_ = null;
this.get_sensor_should_fail_ = false;
@@ -274,12 +268,8 @@ function sensor_mocks(mojo) {
this.active_sensor_ = mockSensor;
}
- let rv =
- core.duplicateBufferHandle(
- this.shared_buffer_handle_,
- core.DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE);
-
- assert_equals(rv.result, core.RESULT_OK);
+ let rv = this.shared_buffer_handle_.duplicateBufferHandle();
+ assert_equals(rv.result, Mojo.RESULT_OK);
let default_config = {frequency: 5};

Powered by Google App Engine
This is Rietveld 408576698