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

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

Issue 1924753002: Revert of Added navigator.actions.share experimental web API (stub). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/ballista/share-arity.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/ballista/resources/mock-ballista-service.js
diff --git a/third_party/WebKit/LayoutTests/ballista/resources/mock-ballista-service.js b/third_party/WebKit/LayoutTests/ballista/resources/mock-ballista-service.js
deleted file mode 100644
index 790aaf61a199914310276391c97e6dcc200ea132..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/ballista/resources/mock-ballista-service.js
+++ /dev/null
@@ -1,66 +0,0 @@
-'use strict';
-
-let mockBallistaService = loadMojoModules(
- 'mockBallistaService',
- ['mojo/public/js/router',
- 'third_party/WebKit/public/platform/modules/ballista/ballista.mojom',
- ]).then(mojo => {
- let [router, ballista] = mojo.modules;
-
- class MockBallistaService extends ballista.BallistaService.stubClass {
- constructor(serviceRegistry) {
- super();
- serviceRegistry.addServiceOverrideForTesting(
- ballista.BallistaService.name,
- handle => this.connect_(handle));
- }
-
- // Returns a Promise that gets rejected if the test should fail.
- init_() {
- // sequence of [expectedTitle, expectedText, result].
- this.shareResultQueue_ = [];
-
- return new Promise((resolve, reject) => {this.reject_ = reject});
- }
-
- connect_(handle) {
- this.router_ = new router.Router(handle);
- this.router_.setIncomingReceiver(this);
- }
-
- share(title, text) {
- let callback = null;
- let result = new Promise(resolve => {callback = resolve;});
-
- if (!this.shareResultQueue_.length) {
- this.reject_('Unexpected call to mojo share method');
- return result;
- }
-
- let expectedTitle, expectedText, error;
- [expectedTitle, expectedText, error] = this.shareResultQueue_.shift();
- try {
- assert_equals(title, expectedTitle);
- assert_equals(text, expectedText);
- } catch (e) {
- this.reject_(e);
- return result;
- }
- callback({error: error});
-
- return result;
- }
-
- pushShareResult(expectedTitle, expectedText, result) {
- this.shareResultQueue_.push([expectedTitle, expectedText, result]);
- }
- }
- return new MockBallistaService(mojo.frameServiceRegistry);
-});
-
-function ballista_test(func, name, properties) {
- promise_test(t => mockBallistaService.then(mock => {
- let mockPromise = mock.init_();
- return Promise.race([func(t, mock), mockPromise]);
- }), name, properties);
-}
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/ballista/share-arity.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698