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

Unified Diff: third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js

Issue 2643473002: [Presentation API] Allow PresentationConnection state change to "Connecting" (Closed)
Patch Set: Address Mark and Bin's comments Created 3 years, 11 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/presentation/resources/presentation-service-mock.js
diff --git a/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js b/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js
index 3db3d1ea3ca4bddcb83bb9f1701627cd94f5f5a6..eee573bdd50411abd5d3bfece1382dd3f850e1b0 100644
--- a/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js
+++ b/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js
@@ -4,13 +4,12 @@
"use strict";
-let presentationServiceMock = loadMojoModules(
- 'presentationServiceMock',
- [
+const presentationServiceMock =
+ loadMojoModules('presentationServiceMock', [
'third_party/WebKit/public/platform/modules/presentation/presentation.mojom',
'mojo/public/js/bindings',
]).then(mojo => {
- let [ presentationService, bindings ] = mojo.modules;
+ const [presentationService, bindings] = mojo.modules;
class PresentationServiceMock {
constructor(interfaceProvider) {
@@ -23,6 +22,8 @@ let presentationServiceMock = loadMojoModules(
presentationService.PresentationService);
}
+ setClient(client) { this.client_ = client; }
+
startSession(urls) {
return Promise.resolve({
sessionInfo: { url: urls[0], id: 'fakesession' },
@@ -36,6 +37,12 @@ let presentationServiceMock = loadMojoModules(
error: null,
});
}
+
+ closeConnection(url, id) {
+ this.client_.onConnectionClosed(
+ {url: url, id: id},
+ presentationService.PresentationConnectionCloseReason.CLOSED, '');
+ }
}
return new PresentationServiceMock(mojo.frameInterfaces);
@@ -47,9 +54,9 @@ function waitForClick(callback, button) {
if (!('eventSender' in window))
return;
- var boundingRect = button.getBoundingClientRect();
- var x = boundingRect.left + boundingRect.width / 2;
- var y = boundingRect.top + boundingRect.height / 2;
+ const boundingRect = button.getBoundingClientRect();
+ const x = boundingRect.left + boundingRect.width / 2;
+ const y = boundingRect.top + boundingRect.height / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();

Powered by Google App Engine
This is Rietveld 408576698