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

Side by Side Diff: mojo/edk/js/tests/connection_tests.js

Issue 1880823005: [mojo-edk] Add explicit message object APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « mojo/edk/js/core.cc ('k') | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 define([ 5 define([
6 "gin/test/expect", 6 "gin/test/expect",
7 "mojo/public/js/connection", 7 "mojo/public/js/connection",
8 "mojo/public/js/core", 8 "mojo/public/js/core",
9 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom", 9 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom",
10 "mojo/public/interfaces/bindings/tests/sample_service.mojom", 10 "mojo/public/interfaces/bindings/tests/sample_service.mojom",
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 foo.name = "Example name"; 60 foo.name = "Example name";
61 foo.source = sourcePipe.handle0; 61 foo.source = sourcePipe.handle0;
62 var promise = connection1.remote.frobinate( 62 var promise = connection1.remote.frobinate(
63 foo, sample_service.Service.BazOptions.REGULAR, anotherPipe.handle0) 63 foo, sample_service.Service.BazOptions.REGULAR, anotherPipe.handle0)
64 .then(function(response) { 64 .then(function(response) {
65 expect(response.result).toBe(42); 65 expect(response.result).toBe(42);
66 66
67 connection0.close(); 67 connection0.close();
68 connection1.close(); 68 connection1.close();
69 69
70 // The Connection objects are responsible for closing these handles.
71 expect(core.close(pipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT);
72 expect(core.close(pipe.handle1)).toBe(core.RESULT_INVALID_ARGUMENT);
73
74 return Promise.resolve(); 70 return Promise.resolve();
75 }); 71 });
76 72
77 // sourcePipe.handle0 was closed automatically when sent over IPC.
78 expect(core.close(sourcePipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT);
79 // sourcePipe.handle1 hasn't been closed yet. 73 // sourcePipe.handle1 hasn't been closed yet.
80 expect(core.close(sourcePipe.handle1)).toBe(core.RESULT_OK); 74 expect(core.close(sourcePipe.handle1)).toBe(core.RESULT_OK);
81 75
82 // anotherPipe.handle0 was closed automatically when sent over IPC.
83 expect(core.close(anotherPipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT);
84 // anotherPipe.handle1 hasn't been closed yet. 76 // anotherPipe.handle1 hasn't been closed yet.
85 expect(core.close(anotherPipe.handle1)).toBe(core.RESULT_OK); 77 expect(core.close(anotherPipe.handle1)).toBe(core.RESULT_OK);
86 78
87 return promise; 79 return promise;
88 } 80 }
89 81
90 function testWriteToClosedPipe() { 82 function testWriteToClosedPipe() {
91 var pipe = core.createMessagePipe(); 83 var pipe = core.createMessagePipe();
92 var anotherPipe = core.createMessagePipe(); 84 var anotherPipe = core.createMessagePipe();
93 85
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 throw Error("Expected echoString to fail."); 148 throw Error("Expected echoString to fail.");
157 }, function(error) { 149 }, function(error) {
158 expect(error.message).toBe("Connection error: " + core.RESULT_UNKNOWN); 150 expect(error.message).toBe("Connection error: " + core.RESULT_UNKNOWN);
159 151
160 return Promise.resolve(); 152 return Promise.resolve();
161 }); 153 });
162 154
163 return promise; 155 return promise;
164 } 156 }
165 }); 157 });
OLDNEW
« no previous file with comments | « mojo/edk/js/core.cc ('k') | mojo/edk/system/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698