| 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.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
| 8 | 8 |
| 9 import org.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // values as either 32-bit integers or doubles, though this should not | 165 // values as either 32-bit integers or doubles, though this should not |
| 166 // affect the result. | 166 // affect the result. |
| 167 @SmallTest | 167 @SmallTest |
| 168 @Feature({"AndroidWebView", "Android-JavaBridge"}) | 168 @Feature({"AndroidWebView", "Android-JavaBridge"}) |
| 169 public void testPassNumberInt32() throws Throwable { | 169 public void testPassNumberInt32() throws Throwable { |
| 170 executeJavaScript("testObject.setByteValue(42);"); | 170 executeJavaScript("testObject.setByteValue(42);"); |
| 171 assertEquals(42, mTestObject.waitForByteValue()); | 171 assertEquals(42, mTestObject.waitForByteValue()); |
| 172 executeJavaScript("testObject.setByteValue(" + Byte.MAX_VALUE + " + 42);
"); | 172 executeJavaScript("testObject.setByteValue(" + Byte.MAX_VALUE + " + 42);
"); |
| 173 assertEquals(Byte.MIN_VALUE + 42 - 1, mTestObject.waitForByteValue()); | 173 assertEquals(Byte.MIN_VALUE + 42 - 1, mTestObject.waitForByteValue()); |
| 174 | 174 |
| 175 // LIVECONNECT_COMPLIANCE: Should convert to numeric char value. | |
| 176 executeJavaScript("testObject.setCharValue(42);"); | 175 executeJavaScript("testObject.setCharValue(42);"); |
| 177 assertEquals('\u0000', mTestObject.waitForCharValue()); | 176 assertEquals(42, mTestObject.waitForCharValue()); |
| 178 | 177 |
| 179 executeJavaScript("testObject.setShortValue(42);"); | 178 executeJavaScript("testObject.setShortValue(42);"); |
| 180 assertEquals(42, mTestObject.waitForShortValue()); | 179 assertEquals(42, mTestObject.waitForShortValue()); |
| 181 executeJavaScript("testObject.setShortValue(" + Short.MAX_VALUE + " + 42
);"); | 180 executeJavaScript("testObject.setShortValue(" + Short.MAX_VALUE + " + 42
);"); |
| 182 assertEquals(Short.MIN_VALUE + 42 - 1, mTestObject.waitForShortValue()); | 181 assertEquals(Short.MIN_VALUE + 42 - 1, mTestObject.waitForShortValue()); |
| 183 | 182 |
| 184 executeJavaScript("testObject.setIntValue(42);"); | 183 executeJavaScript("testObject.setIntValue(42);"); |
| 185 assertEquals(42, mTestObject.waitForIntValue()); | 184 assertEquals(42, mTestObject.waitForIntValue()); |
| 186 | 185 |
| 187 executeJavaScript("testObject.setLongValue(42);"); | 186 executeJavaScript("testObject.setLongValue(42);"); |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 public void testPassFunctionObject() throws Throwable { | 723 public void testPassFunctionObject() throws Throwable { |
| 725 executeJavaScript("func = new Function('a', 'b', 'return a + b');"); | 724 executeJavaScript("func = new Function('a', 'b', 'return a + b');"); |
| 726 | 725 |
| 727 executeJavaScript("testObject.setStringValue(func);"); | 726 executeJavaScript("testObject.setStringValue(func);"); |
| 728 assertEquals("undefined", mTestObject.waitForStringValue()); | 727 assertEquals("undefined", mTestObject.waitForStringValue()); |
| 729 | 728 |
| 730 executeJavaScript("testObject.setObjectValue(func);"); | 729 executeJavaScript("testObject.setObjectValue(func);"); |
| 731 assertNull(mTestObject.waitForObjectValue()); | 730 assertNull(mTestObject.waitForObjectValue()); |
| 732 } | 731 } |
| 733 } | 732 } |
| OLD | NEW |