Chromium Code Reviews| 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.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
| 8 import android.util.Pair; | 8 import android.util.Pair; |
| 9 | 9 |
| 10 import org.chromium.android_webview.AwContents; | 10 import org.chromium.android_webview.AwContents; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 673 assertTrue(mShouldInterceptRequestHelper.getUrls().get(1).endsWith( | 673 assertTrue(mShouldInterceptRequestHelper.getUrls().get(1).endsWith( |
| 674 CommonResources.FAVICON_FILENAME)); | 674 CommonResources.FAVICON_FILENAME)); |
| 675 } | 675 } |
| 676 | 676 |
| 677 @SmallTest | 677 @SmallTest |
| 678 @Feature({"AndroidWebView"}) | 678 @Feature({"AndroidWebView"}) |
| 679 public void testOnReceivedErrorCallback() throws Throwable { | 679 public void testOnReceivedErrorCallback() throws Throwable { |
| 680 mShouldInterceptRequestHelper.setReturnValue(new AwWebResourceResponse(n ull, null, null)); | 680 mShouldInterceptRequestHelper.setReturnValue(new AwWebResourceResponse(n ull, null, null)); |
| 681 OnReceivedErrorHelper onReceivedErrorHelper = mContentsClient.getOnRecei vedErrorHelper(); | 681 OnReceivedErrorHelper onReceivedErrorHelper = mContentsClient.getOnRecei vedErrorHelper(); |
| 682 int onReceivedErrorHelperCallCount = onReceivedErrorHelper.getCallCount( ); | 682 int onReceivedErrorHelperCallCount = onReceivedErrorHelper.getCallCount( ); |
| 683 loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), "foo ://bar"); | 683 loadUrlSync(mAwContents, onReceivedErrorHelper, "foo://bar"); |
| 684 onReceivedErrorHelper.waitForCallback(onReceivedErrorHelperCallCount, 1) ; | 684 onReceivedErrorHelper.waitForCallback(onReceivedErrorHelperCallCount, 1) ; |
|
gsennton
2016/07/26 15:35:19
This call is now unnecessary given that you pass o
Nate Chapin
2016/07/26 18:39:01
Done.
| |
| 685 } | 685 } |
| 686 | 686 |
| 687 @SmallTest | 687 @SmallTest |
| 688 @Feature({"AndroidWebView"}) | 688 @Feature({"AndroidWebView"}) |
| 689 public void testNoOnReceivedErrorCallback() throws Throwable { | 689 public void testNoOnReceivedErrorCallback() throws Throwable { |
| 690 final String imagePath = "/" + CommonResources.FAVICON_FILENAME; | 690 final String imagePath = "/" + CommonResources.FAVICON_FILENAME; |
| 691 final String imageUrl = mWebServer.setResponseBase64(imagePath, | 691 final String imageUrl = mWebServer.setResponseBase64(imagePath, |
| 692 CommonResources.FAVICON_DATA_BASE64, CommonResources.getImagePng Headers(true)); | 692 CommonResources.FAVICON_DATA_BASE64, CommonResources.getImagePng Headers(true)); |
| 693 final String pageWithImage = | 693 final String pageWithImage = |
| 694 addPageToTestServer(mWebServer, "/page_with_image.html", | 694 addPageToTestServer(mWebServer, "/page_with_image.html", |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 869 mAwContents = mTestContainerView.getAwContents(); | 869 mAwContents = mTestContainerView.getAwContents(); |
| 870 loadUrlAsync(mAwContents, "http://www.example.com"); | 870 loadUrlAsync(mAwContents, "http://www.example.com"); |
| 871 waitForShouldInterceptRequest.await(); | 871 waitForShouldInterceptRequest.await(); |
| 872 // The following call will try to send an IPC and wait for a reply from renderer. | 872 // The following call will try to send an IPC and wait for a reply from renderer. |
| 873 // We do not check the actual result, because it can be bogus. The impor tant | 873 // We do not check the actual result, because it can be bogus. The impor tant |
| 874 // thing is that the call does not cause a deadlock. | 874 // thing is that the call does not cause a deadlock. |
| 875 executeJavaScriptAndWaitForResult(mAwContents, client, "1+1"); | 875 executeJavaScriptAndWaitForResult(mAwContents, client, "1+1"); |
| 876 signalAfterSendingIpc.countDown(); | 876 signalAfterSendingIpc.countDown(); |
| 877 } | 877 } |
| 878 } | 878 } |
| OLD | NEW |