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

Side by Side Diff: third_party/protobuf/java/core/src/test/java/com/google/protobuf/ServiceTest.java

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 24 matching lines...) Expand all
35 import google.protobuf.no_generic_services_test.UnittestNoGenericServices; 35 import google.protobuf.no_generic_services_test.UnittestNoGenericServices;
36 import protobuf_unittest.MessageWithNoOuter; 36 import protobuf_unittest.MessageWithNoOuter;
37 import protobuf_unittest.ServiceWithNoOuter; 37 import protobuf_unittest.ServiceWithNoOuter;
38 import protobuf_unittest.UnittestProto.BarRequest; 38 import protobuf_unittest.UnittestProto.BarRequest;
39 import protobuf_unittest.UnittestProto.BarResponse; 39 import protobuf_unittest.UnittestProto.BarResponse;
40 import protobuf_unittest.UnittestProto.FooRequest; 40 import protobuf_unittest.UnittestProto.FooRequest;
41 import protobuf_unittest.UnittestProto.FooResponse; 41 import protobuf_unittest.UnittestProto.FooResponse;
42 import protobuf_unittest.UnittestProto.TestAllTypes; 42 import protobuf_unittest.UnittestProto.TestAllTypes;
43 import protobuf_unittest.UnittestProto.TestService; 43 import protobuf_unittest.UnittestProto.TestService;
44 44
45 import java.util.HashSet;
46 import java.util.Set;
45 import junit.framework.TestCase; 47 import junit.framework.TestCase;
46
47 import org.easymock.classextension.EasyMock; 48 import org.easymock.classextension.EasyMock;
48 import org.easymock.IArgumentMatcher; 49 import org.easymock.IArgumentMatcher;
49 import org.easymock.classextension.IMocksControl; 50 import org.easymock.classextension.IMocksControl;
50 51
51 import java.util.HashSet;
52 import java.util.Set;
53
54 /** 52 /**
55 * Tests services and stubs. 53 * Tests services and stubs.
56 * 54 *
57 * @author kenton@google.com Kenton Varda 55 * @author kenton@google.com Kenton Varda
58 */ 56 */
59 public class ServiceTest extends TestCase { 57 public class ServiceTest extends TestCase {
60 private IMocksControl control; 58 private IMocksControl control;
61 private RpcController mockController; 59 private RpcController mockController;
62 60
63 private final Descriptors.MethodDescriptor fooDescriptor = 61 private final Descriptors.MethodDescriptor fooDescriptor =
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 262
265 // But descriptors are there. 263 // But descriptors are there.
266 FileDescriptor file = UnittestNoGenericServices.getDescriptor(); 264 FileDescriptor file = UnittestNoGenericServices.getDescriptor();
267 assertEquals(1, file.getServices().size()); 265 assertEquals(1, file.getServices().size());
268 assertEquals("TestService", file.getServices().get(0).getName()); 266 assertEquals("TestService", file.getServices().get(0).getName());
269 assertEquals(1, file.getServices().get(0).getMethods().size()); 267 assertEquals(1, file.getServices().get(0).getMethods().size());
270 assertEquals("Foo", 268 assertEquals("Foo",
271 file.getServices().get(0).getMethods().get(0).getName()); 269 file.getServices().get(0).getMethods().get(0).getName());
272 } 270 }
273 271
272
273
274 // ================================================================= 274 // =================================================================
275 275
276 /** 276 /**
277 * wrapsCallback() is an EasyMock argument predicate. wrapsCallback(c) 277 * wrapsCallback() is an EasyMock argument predicate. wrapsCallback(c)
278 * matches a callback if calling that callback causes c to be called. 278 * matches a callback if calling that callback causes c to be called.
279 * In other words, c wraps the given callback. 279 * In other words, c wraps the given callback.
280 */ 280 */
281 private <Type extends Message> RpcCallback<Type> wrapsCallback( 281 private <Type extends Message> RpcCallback<Type> wrapsCallback(
282 MockCallback<?> callback) { 282 MockCallback<?> callback) {
283 EasyMock.reportMatcher(new WrapsCallback(callback)); 283 EasyMock.reportMatcher(new WrapsCallback(callback));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 actualCallback.run(null); 317 actualCallback.run(null);
318 return callback.isCalled(); 318 return callback.isCalled();
319 } 319 }
320 320
321 @Override 321 @Override
322 public void appendTo(StringBuffer buffer) { 322 public void appendTo(StringBuffer buffer) {
323 buffer.append("wrapsCallback(mockCallback)"); 323 buffer.append("wrapsCallback(mockCallback)");
324 } 324 }
325 } 325 }
326 } 326 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698