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 static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
8 | 8 |
9 import android.support.test.filters.SmallTest; | 9 import android.support.test.filters.SmallTest; |
10 | 10 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 assertEquals("I'm here", mTestController.waitForStringValue()); | 174 assertEquals("I'm here", mTestController.waitForStringValue()); |
175 synchronousPageReload(); | 175 synchronousPageReload(); |
176 assertEquals("undefined", executeJavaScriptAndGetStringResult("typeof te
stObject")); | 176 assertEquals("undefined", executeJavaScriptAndGetStringResult("typeof te
stObject")); |
177 } | 177 } |
178 | 178 |
179 @SmallTest | 179 @SmallTest |
180 @Feature({"AndroidWebView", "Android-JavaBridge"}) | 180 @Feature({"AndroidWebView", "Android-JavaBridge"}) |
181 public void testRemoveObjectNotAdded() throws Throwable { | 181 public void testRemoveObjectNotAdded() throws Throwable { |
182 TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishedHelper = | 182 TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishedHelper = |
183 getTestCallBackHelperContainer().getOnPageFinishedHelper(); | 183 getTestCallBackHelperContainer().getOnPageFinishedHelper(); |
| 184 |
184 int currentCallCount = onPageFinishedHelper.getCallCount(); | 185 int currentCallCount = onPageFinishedHelper.getCallCount(); |
185 runTestOnUiThread(new Runnable() { | 186 runTestOnUiThread(new Runnable() { |
186 @Override | 187 @Override |
187 public void run() { | 188 public void run() { |
188 getContentViewCore().removeJavascriptInterface("foo"); | 189 getContentViewCore().removeJavascriptInterface("foo"); |
189 getContentViewCore().getWebContents().getNavigationController().
reload(true); | 190 getContentViewCore().getWebContents().getNavigationController().
reload(true); |
190 } | 191 } |
191 }); | 192 }); |
192 onPageFinishedHelper.waitForCallback(currentCallCount); | 193 onPageFinishedHelper.waitForCallback(currentCallCount); |
193 assertEquals("undefined", executeJavaScriptAndGetStringResult("typeof fo
o")); | 194 assertEquals("undefined", executeJavaScriptAndGetStringResult("typeof fo
o")); |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 executeJavaScript("testObject1.method()"); | 986 executeJavaScript("testObject1.method()"); |
986 assertEquals(1, mTestController.waitForIntValue()); | 987 assertEquals(1, mTestController.waitForIntValue()); |
987 executeJavaScript("testObject2.method()"); | 988 executeJavaScript("testObject2.method()"); |
988 assertEquals(2, mTestController.waitForIntValue()); | 989 assertEquals(2, mTestController.waitForIntValue()); |
989 executeJavaScript("testObject1.method.call(testObject2)"); | 990 executeJavaScript("testObject1.method.call(testObject2)"); |
990 assertEquals(2, mTestController.waitForIntValue()); | 991 assertEquals(2, mTestController.waitForIntValue()); |
991 executeJavaScript("testObject2.method.call(testObject1)"); | 992 executeJavaScript("testObject2.method.call(testObject1)"); |
992 assertEquals(1, mTestController.waitForIntValue()); | 993 assertEquals(1, mTestController.waitForIntValue()); |
993 } | 994 } |
994 } | 995 } |
OLD | NEW |