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

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

Issue 2491693003: Add tests for PresentationConnectionAvailable constructor. (Closed)
Patch Set: review comments Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/LayoutTests/presentation/presentationconnectionavailableevent-ctor-mock.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..9b2dbd028368c295776bad6fea7a35384a5e2b49
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js
@@ -0,0 +1,39 @@
+/*
+ * Mock implementation of mojo PresentationService.
+ */
+
+"use strict";
+
+let presentationServiceMock = loadMojoModules(
+ 'presentationServiceMock',
+ [
+ 'third_party/WebKit/public/platform/modules/presentation/presentation.mojom',
+ 'mojo/public/js/router',
+ ]).then(mojo => {
+ let [ presentationService, router ] = mojo.modules;
+
+ class PresentationServiceMock {
+ constructor(interfaceProvider) {
+ interfaceProvider.addInterfaceOverrideForTesting(
+ presentationService.PresentationService.name,
+ handle => this.connectPresentationService_(handle));
+ this.interfaceProvider_ = interfaceProvider;
+ this.pendingResponse_ = null;
+ }
+
+ connectPresentationService_(handle) {
+ this.presentationServiceStub_ = new presentationService.PresentationService.stubClass(this);
+ this.presentationServiceRouter_ = new router.Router(handle);
+ this.presentationServiceRouter_.setIncomingReceiver(this.presentationServiceStub_);
+ }
+
+ startSession(urls) {
+ return Promise.resolve({
+ sessionInfo: { url: urls[0], id: 'fakesession' },
+ error: null,
+ });
+ }
+ }
+
+ return new PresentationServiceMock(mojo.frameInterfaces);
+ });
« no previous file with comments | « third_party/WebKit/LayoutTests/presentation/presentationconnectionavailableevent-ctor-mock.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698