| 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.MediumTest; | 7 import android.test.suitebuilder.annotation.MediumTest; |
| 8 | 8 |
| 9 import org.chromium.android_webview.AwContents; | 9 import org.chromium.android_webview.AwContents; |
| 10 import org.chromium.android_webview.test.util.CommonResources; | 10 import org.chromium.android_webview.test.util.CommonResources; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 onPageFinishedHelper.waitForCallback(currentCallCount); | 50 onPageFinishedHelper.waitForCallback(currentCallCount); |
| 51 assertEquals("data:text/html," + html, onPageFinishedHelper.getUrl()); | 51 assertEquals("data:text/html," + html, onPageFinishedHelper.getUrl()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 @MediumTest | 54 @MediumTest |
| 55 @Feature({"AndroidWebView"}) | 55 @Feature({"AndroidWebView"}) |
| 56 @FlakyTest(message = "crbug.com/652577") | 56 @FlakyTest(message = "crbug.com/652577") |
| 57 public void testCalledAfterError() throws Throwable { | 57 public void testCalledAfterError() throws Throwable { |
| 58 class LocalTestClient extends TestAwContentsClient { | 58 class LocalTestClient extends TestAwContentsClient { |
| 59 private boolean mIsOnReceivedErrorCalled = false; | 59 private boolean mIsOnReceivedErrorCalled; |
| 60 private boolean mIsOnPageFinishedCalled = false; | 60 private boolean mIsOnPageFinishedCalled; |
| 61 private boolean mAllowAboutBlank = false; | 61 private boolean mAllowAboutBlank; |
| 62 | 62 |
| 63 @Override | 63 @Override |
| 64 public void onReceivedError(int errorCode, String description, Strin
g failingUrl) { | 64 public void onReceivedError(int errorCode, String description, Strin
g failingUrl) { |
| 65 assertEquals("onReceivedError called twice for " + failingUrl, | 65 assertEquals("onReceivedError called twice for " + failingUrl, |
| 66 false, mIsOnReceivedErrorCalled); | 66 false, mIsOnReceivedErrorCalled); |
| 67 mIsOnReceivedErrorCalled = true; | 67 mIsOnReceivedErrorCalled = true; |
| 68 assertEquals("onPageFinished called before onReceivedError for "
+ failingUrl, | 68 assertEquals("onPageFinished called before onReceivedError for "
+ failingUrl, |
| 69 false, mIsOnPageFinishedCalled); | 69 false, mIsOnPageFinishedCalled); |
| 70 super.onReceivedError(errorCode, description, failingUrl); | 70 super.onReceivedError(errorCode, description, failingUrl); |
| 71 } | 71 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 mContentsClient.getOnPageFinishedHelper(); | 417 mContentsClient.getOnPageFinishedHelper(); |
| 418 int currentCallCount = onPageFinishedHelper.getCallCount(); | 418 int currentCallCount = onPageFinishedHelper.getCallCount(); |
| 419 loadUrlAsync(mAwContents, url); | 419 loadUrlAsync(mAwContents, url); |
| 420 onPageFinishedHelper.waitForCallback(currentCallCount); | 420 onPageFinishedHelper.waitForCallback(currentCallCount); |
| 421 assertEquals(url, onPageFinishedHelper.getUrl()); | 421 assertEquals(url, onPageFinishedHelper.getUrl()); |
| 422 } finally { | 422 } finally { |
| 423 webServer.shutdown(); | 423 webServer.shutdown(); |
| 424 } | 424 } |
| 425 } | 425 } |
| 426 } | 426 } |
| OLD | NEW |