| 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.android_webview.test; | 5 package org.chromium.android_webview.test; |
| 6 | 6 |
| 7 import android.os.Build; | 7 import android.os.Build; |
| 8 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
| 9 import android.util.Pair; | 9 import android.util.Pair; |
| 10 | 10 |
| 11 import org.chromium.android_webview.AwContents; | 11 import org.chromium.android_webview.AwContents; |
| 12 import org.chromium.android_webview.test.util.CommonResources; | 12 import org.chromium.android_webview.test.util.CommonResources; |
| 13 import org.chromium.android_webview.test.util.JSUtils; | 13 import org.chromium.android_webview.test.util.JSUtils; |
| 14 import org.chromium.base.annotations.SuppressFBWarnings; |
| 14 import org.chromium.base.test.util.DisabledTest; | 15 import org.chromium.base.test.util.DisabledTest; |
| 15 import org.chromium.base.test.util.Feature; | 16 import org.chromium.base.test.util.Feature; |
| 16 import org.chromium.base.test.util.MinAndroidSdkLevel; | 17 import org.chromium.base.test.util.MinAndroidSdkLevel; |
| 17 import org.chromium.content.browser.test.util.CallbackHelper; | 18 import org.chromium.content.browser.test.util.CallbackHelper; |
| 18 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
StartedHelper; | 19 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
StartedHelper; |
| 19 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnRece
ivedErrorHelper; | 20 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnRece
ivedErrorHelper; |
| 20 import org.chromium.content_public.browser.LoadUrlParams; | 21 import org.chromium.content_public.browser.LoadUrlParams; |
| 21 import org.chromium.net.test.util.TestWebServer; | 22 import org.chromium.net.test.util.TestWebServer; |
| 22 | 23 |
| 23 import java.util.ArrayList; | 24 import java.util.ArrayList; |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 false)); | 819 false)); |
| 819 awContents.loadUrl(new LoadUrlParams(jsUrl)); | 820 awContents.loadUrl(new LoadUrlParams(jsUrl)); |
| 820 } | 821 } |
| 821 }); | 822 }); |
| 822 contentsClient.getOnPageFinishedHelper().waitForCallback(currentCallCoun
t, 1, | 823 contentsClient.getOnPageFinishedHelper().waitForCallback(currentCallCoun
t, 1, |
| 823 WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS); | 824 WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS); |
| 824 | 825 |
| 825 assertEquals(0, shouldOverrideUrlLoadingHelper.getCallCount()); | 826 assertEquals(0, shouldOverrideUrlLoadingHelper.getCallCount()); |
| 826 } | 827 } |
| 827 | 828 |
| 829 @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE") |
| 828 @SmallTest | 830 @SmallTest |
| 829 @Feature({"AndroidWebView"}) | 831 @Feature({"AndroidWebView"}) |
| 830 public void testCallDestroyInCallback() throws Throwable { | 832 public void testCallDestroyInCallback() throws Throwable { |
| 831 class DestroyInCallbackClient extends TestAwContentsClient { | 833 class DestroyInCallbackClient extends TestAwContentsClient { |
| 832 private AwContents mAwContents; | 834 private AwContents mAwContents; |
| 833 | 835 |
| 834 public void setAwContents(AwContents awContents) { | 836 public void setAwContents(AwContents awContents) { |
| 835 mAwContents = awContents; | 837 mAwContents = awContents; |
| 836 } | 838 } |
| 837 | 839 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 862 shouldOverrideUrlLoadingHelper.waitForCallback(shouldOverrideUrlLoadingC
allCount); | 864 shouldOverrideUrlLoadingHelper.waitForCallback(shouldOverrideUrlLoadingC
allCount); |
| 863 | 865 |
| 864 pollOnUiThread(new Callable<Boolean>() { | 866 pollOnUiThread(new Callable<Boolean>() { |
| 865 @Override | 867 @Override |
| 866 public Boolean call() { | 868 public Boolean call() { |
| 867 return AwContents.getNativeInstanceCount() == 0; | 869 return AwContents.getNativeInstanceCount() == 0; |
| 868 } | 870 } |
| 869 }); | 871 }); |
| 870 } | 872 } |
| 871 } | 873 } |
| OLD | NEW |