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

Side by Side Diff: mojo/android/javatests/src/org/chromium/mojo/bindings/BindingsTest.java

Issue 397453004: Mojo: Correctly handle large unsigned integer literals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ULL Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/apps/js/bindings/sample_service_unittests.js » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 package org.chromium.mojo.bindings; 5 package org.chromium.mojo.bindings;
6 6
7 import android.test.suitebuilder.annotation.SmallTest; 7 import android.test.suitebuilder.annotation.SmallTest;
8 8
9 import junit.framework.TestCase; 9 import junit.framework.TestCase;
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 public void testStructDefaults() throws NoSuchFieldException, SecurityExcept ion, 172 public void testStructDefaults() throws NoSuchFieldException, SecurityExcept ion,
173 IllegalArgumentException, IllegalAccessException { 173 IllegalArgumentException, IllegalAccessException {
174 // Check default values. 174 // Check default values.
175 DefaultsTest test = new DefaultsTest(); 175 DefaultsTest test = new DefaultsTest();
176 176
177 checkField(DefaultsTest.class.getField("a0"), byte.class, test, (byte) - 12); 177 checkField(DefaultsTest.class.getField("a0"), byte.class, test, (byte) - 12);
178 checkField(DefaultsTest.class.getField("a1"), byte.class, test, (byte) 1 2); 178 checkField(DefaultsTest.class.getField("a1"), byte.class, test, (byte) 1 2);
179 checkField(DefaultsTest.class.getField("a2"), short.class, test, (short) 1234); 179 checkField(DefaultsTest.class.getField("a2"), short.class, test, (short) 1234);
180 checkField(DefaultsTest.class.getField("a3"), short.class, test, (short) 34567); 180 checkField(DefaultsTest.class.getField("a3"), short.class, test, (short) 34567);
181 checkField(DefaultsTest.class.getField("a4"), int.class, test, 123456); 181 checkField(DefaultsTest.class.getField("a4"), int.class, test, 123456);
182 checkField(DefaultsTest.class.getField("a5"), int.class, test, (int) 345 6789012L);
182 checkField(DefaultsTest.class.getField("a6"), long.class, test, 11111111 1111L); 183 checkField(DefaultsTest.class.getField("a6"), long.class, test, 11111111 1111L);
184 // -8446744073709551617 == 9999999999999999999 - 2 ^ 64.
185 checkField(DefaultsTest.class.getField("a7"), long.class, test, -8446744 073709551617L);
183 checkField(DefaultsTest.class.getField("a8"), int.class, test, 0x12345); 186 checkField(DefaultsTest.class.getField("a8"), int.class, test, 0x12345);
184 checkField(DefaultsTest.class.getField("a9"), int.class, test, -0x12345) ; 187 checkField(DefaultsTest.class.getField("a9"), int.class, test, -0x12345) ;
185 checkField(DefaultsTest.class.getField("a10"), int.class, test, 1234); 188 checkField(DefaultsTest.class.getField("a10"), int.class, test, 1234);
186 checkField(DefaultsTest.class.getField("a11"), boolean.class, test, true ); 189 checkField(DefaultsTest.class.getField("a11"), boolean.class, test, true );
187 checkField(DefaultsTest.class.getField("a12"), boolean.class, test, fals e); 190 checkField(DefaultsTest.class.getField("a12"), boolean.class, test, fals e);
188 checkField(DefaultsTest.class.getField("a13"), float.class, test, (float ) 123.25); 191 checkField(DefaultsTest.class.getField("a13"), float.class, test, (float ) 123.25);
189 checkField(DefaultsTest.class.getField("a14"), double.class, test, 12345 67890.123); 192 checkField(DefaultsTest.class.getField("a14"), double.class, test, 12345 67890.123);
190 checkField(DefaultsTest.class.getField("a15"), double.class, test, 1E10) ; 193 checkField(DefaultsTest.class.getField("a15"), double.class, test, 1E10) ;
191 checkField(DefaultsTest.class.getField("a16"), double.class, test, -1.2E +20); 194 checkField(DefaultsTest.class.getField("a16"), double.class, test, -1.2E +20);
192 checkField(DefaultsTest.class.getField("a17"), double.class, test, +1.23 E-20); 195 checkField(DefaultsTest.class.getField("a17"), double.class, test, +1.23 E-20);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 @SmallTest 228 @SmallTest
226 public void testFooSerialization() { 229 public void testFooSerialization() {
227 // Checking serialization and deserialization of a Foo object. 230 // Checking serialization and deserialization of a Foo object.
228 Foo typicalFoo = createFoo(); 231 Foo typicalFoo = createFoo();
229 Message serializedFoo = typicalFoo.serialize(null); 232 Message serializedFoo = typicalFoo.serialize(null);
230 Foo deserializedFoo = Foo.deserialize(serializedFoo); 233 Foo deserializedFoo = Foo.deserialize(serializedFoo);
231 assertFooEquals(typicalFoo, deserializedFoo); 234 assertFooEquals(typicalFoo, deserializedFoo);
232 } 235 }
233 236
234 } 237 }
OLDNEW
« no previous file with comments | « no previous file | mojo/apps/js/bindings/sample_service_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698