OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.support.test.filters.SmallTest; | 7 import android.support.test.filters.SmallTest; |
8 | 8 |
9 import org.junit.Assert; | 9 import org.junit.Assert; |
10 import org.junit.Before; | 10 import org.junit.Before; |
(...skipping 13 matching lines...) Expand all Loading... |
24 * The conversions should follow | 24 * The conversions should follow |
25 * http://jdk6.java.net/plugin2/liveconnect/#JS_JAVA_CONVERSIONS. Places in | 25 * http://jdk6.java.net/plugin2/liveconnect/#JS_JAVA_CONVERSIONS. Places in |
26 * which the implementation differs from the spec are marked with | 26 * which the implementation differs from the spec are marked with |
27 * LIVECONNECT_COMPLIANCE. | 27 * LIVECONNECT_COMPLIANCE. |
28 * FIXME: Consider making our implementation more compliant, if it will not | 28 * FIXME: Consider making our implementation more compliant, if it will not |
29 * break backwards-compatibility. See b/4408210. | 29 * break backwards-compatibility. See b/4408210. |
30 */ | 30 */ |
31 @RunWith(BaseJUnit4ClassRunner.class) | 31 @RunWith(BaseJUnit4ClassRunner.class) |
32 public class JavaBridgeReturnValuesTest { | 32 public class JavaBridgeReturnValuesTest { |
33 @Rule | 33 @Rule |
34 public JavaBridgeActivityTestRule mActivityTestRule = new JavaBridgeActivity
TestRule(); | 34 public JavaBridgeActivityTestRule mActivityTestRule = |
| 35 new JavaBridgeActivityTestRule().shouldSetUp(true); |
35 | 36 |
36 // An instance of this class is injected into the page to test returning | 37 // An instance of this class is injected into the page to test returning |
37 // Java values to JavaScript. | 38 // Java values to JavaScript. |
38 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") | 39 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") |
39 private static class TestObject extends Controller { | 40 private static class TestObject extends Controller { |
40 private String mStringResult; | 41 private String mStringResult; |
41 private boolean mBooleanResult; | 42 private boolean mBooleanResult; |
42 | 43 |
43 // These four methods are used to control the test. | 44 // These four methods are used to control the test. |
44 public synchronized void setStringResult(String x) { | 45 public synchronized void setStringResult(String x) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 Assert.assertTrue(executeJavaScriptAndGetBooleanResult( | 200 Assert.assertTrue(executeJavaScriptAndGetBooleanResult( |
200 "42.0 === testObject.getDoubleValueNoDecimal()")); | 201 "42.0 === testObject.getDoubleValueNoDecimal()")); |
201 Assert.assertEquals( | 202 Assert.assertEquals( |
202 "foo", executeJavaScriptAndGetStringResult("testObject.getString
Value()")); | 203 "foo", executeJavaScriptAndGetStringResult("testObject.getString
Value()")); |
203 Assert.assertEquals( | 204 Assert.assertEquals( |
204 "", executeJavaScriptAndGetStringResult("testObject.getEmptyStri
ngValue()")); | 205 "", executeJavaScriptAndGetStringResult("testObject.getEmptyStri
ngValue()")); |
205 Assert.assertTrue( | 206 Assert.assertTrue( |
206 executeJavaScriptAndGetBooleanResult("undefined === testObject.g
etVoidValue()")); | 207 executeJavaScriptAndGetBooleanResult("undefined === testObject.g
etVoidValue()")); |
207 } | 208 } |
208 } | 209 } |
OLD | NEW |