| 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; |
| 11 import org.junit.Rule; | 11 import org.junit.Rule; |
| 12 import org.junit.Test; | 12 import org.junit.Test; |
| 13 import org.junit.runner.RunWith; | 13 import org.junit.runner.RunWith; |
| 14 | 14 |
| 15 import org.chromium.base.annotations.SuppressFBWarnings; | 15 import org.chromium.base.annotations.SuppressFBWarnings; |
| 16 import org.chromium.base.test.BaseJUnit4ClassRunner; | 16 import org.chromium.base.test.BaseJUnit4ClassRunner; |
| 17 import org.chromium.base.test.util.Feature; | 17 import org.chromium.base.test.util.Feature; |
| 18 import org.chromium.content.browser.JavaBridgeTestCommon.Controller; | 18 import org.chromium.content.browser.JavaBridgeTestCommon.Controller; |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Part of the test suite for the Java Bridge. This test tests the | 21 * Part of the test suite for the Java Bridge. This test tests the |
| 22 * use of fields. | 22 * use of fields. |
| 23 */ | 23 */ |
| 24 @RunWith(BaseJUnit4ClassRunner.class) | 24 @RunWith(BaseJUnit4ClassRunner.class) |
| 25 public class JavaBridgeFieldsTest { | 25 public class JavaBridgeFieldsTest { |
| 26 @Rule | 26 @Rule |
| 27 public JavaBridgeActivityTestRule mActivityTestRule = new JavaBridgeActivity
TestRule(); | 27 public JavaBridgeActivityTestRule mActivityTestRule = |
| 28 new JavaBridgeActivityTestRule().shouldSetUp(true); |
| 28 | 29 |
| 29 @SuppressFBWarnings({"CHROMIUM_SYNCHRONIZED_METHOD", "URF_UNREAD_PUBLIC_OR_P
ROTECTED_FIELD"}) | 30 @SuppressFBWarnings({"CHROMIUM_SYNCHRONIZED_METHOD", "URF_UNREAD_PUBLIC_OR_P
ROTECTED_FIELD"}) |
| 30 private static class TestObject extends Controller { | 31 private static class TestObject extends Controller { |
| 31 private String mStringValue; | 32 private String mStringValue; |
| 32 | 33 |
| 33 // These methods are used to control the test. | 34 // These methods are used to control the test. |
| 34 public synchronized void setStringValue(String x) { | 35 public synchronized void setStringValue(String x) { |
| 35 mStringValue = x; | 36 mStringValue = x; |
| 36 notifyResultIsReady(); | 37 notifyResultIsReady(); |
| 37 } | 38 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 Assert.assertEquals( | 95 Assert.assertEquals( |
| 95 "undefined", executeJavaScriptAndGetStringResult("typeof testObj
ect.doubleField")); | 96 "undefined", executeJavaScriptAndGetStringResult("typeof testObj
ect.doubleField")); |
| 96 Assert.assertEquals( | 97 Assert.assertEquals( |
| 97 "undefined", executeJavaScriptAndGetStringResult("typeof testObj
ect.objectField")); | 98 "undefined", executeJavaScriptAndGetStringResult("typeof testObj
ect.objectField")); |
| 98 Assert.assertEquals( | 99 Assert.assertEquals( |
| 99 "undefined", executeJavaScriptAndGetStringResult("typeof testObj
ect.stringField")); | 100 "undefined", executeJavaScriptAndGetStringResult("typeof testObj
ect.stringField")); |
| 100 Assert.assertEquals("undefined", | 101 Assert.assertEquals("undefined", |
| 101 executeJavaScriptAndGetStringResult("typeof testObject.customTyp
eField")); | 102 executeJavaScriptAndGetStringResult("typeof testObject.customTyp
eField")); |
| 102 } | 103 } |
| 103 } | 104 } |
| OLD | NEW |