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

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

Issue 2730123003: [Presentation API] Add layout test for connection.close() and fix test failures (Closed)
Patch Set: remove unnecessary forward declarations Created 3 years, 9 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 16a3fad53ac8151094d84993d1464214efbc852a..a9b1c76bdb19d24a78e94478ff020bb16ed598a3 100644
--- a/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js
+++ b/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js
@@ -25,6 +25,8 @@ let presentationServiceMock = loadMojoModules(
this.pendingResponse_ = null;
this.bindingSet_ = new bindings.BindingSet(
presentationService.PresentationService);
+ this.controllerConnectionPtr_ = null;
+ this.receiverConnectionRequest_ = null;
this.onSetClient = null;
}
@@ -58,25 +60,43 @@ let presentationServiceMock = loadMojoModules(
setPresentationConnection(
seesionInfo, controllerConnectionPtr, receiverConnectionRequest) {
+ this.controllerConnectionPtr_ = controllerConnectionPtr;
+ this.receiverConnectionRequest_ = receiverConnectionRequest;
this.client_.onConnectionStateChanged(
seesionInfo,
presentationService.PresentationConnectionState.CONNECTED);
}
- onReceiverConnectionAvailable(strUrl, id) {
+ onReceiverConnectionAvailable(
+ strUrl, id, opt_controllerConnectionPtr, opt_receiverConnectionRequest) {
const mojoUrl = new url.Url();
mojoUrl.url = strUrl;
- const controllerConnectionPtr = new presentationService.PresentationConnectionPtr();
- const connectionBinding = new bindings.Binding(
- presentationService.PresentationConnection,
- new MockPresentationConnection(),
- bindings.makeRequest(controllerConnectionPtr));
- const receiverConnectionPtr = new presentationService.PresentationConnectionPtr();
+ var controllerConnectionPtr = opt_controllerConnectionPtr;
+ if (!controllerConnectionPtr) {
+ controllerConnectionPtr = new presentationService.PresentationConnectionPtr();
+ const connectionBinding = new bindings.Binding(
+ presentationService.PresentationConnection,
+ new MockPresentationConnection(),
+ bindings.makeRequest(controllerConnectionPtr));
+ }
+
+ var receiverConnectionRequest = opt_receiverConnectionRequest;
+ if (!receiverConnectionRequest) {
+ receiverConnectionRequest = bindings.makeRequest(
+ new presentationService.PresentationConnectionPtr());
+ }
this.client_.onReceiverConnectionAvailable(
{ url: mojoUrl, id: id },
- controllerConnectionPtr,
- bindings.makeRequest(receiverConnectionPtr));
+ controllerConnectionPtr, receiverConnectionRequest);
+ }
+
+ getControllerConnectionPtr() {
+ return this.controllerConnectionPtr_;
+ }
+
+ getReceiverConnectionRequest() {
+ return this.receiverConnectionRequest_;
}
}

Powered by Google App Engine
This is Rietveld 408576698