| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.webkit.WebSettings; | 8 import android.webkit.WebSettings; |
| 9 | 9 |
| 10 import org.chromium.android_webview.AwContents; | 10 import org.chromium.android_webview.AwContents; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 private void startWebServer() throws Exception { | 51 private void startWebServer() throws Exception { |
| 52 mWebServer = TestWebServer.start(); | 52 mWebServer = TestWebServer.start(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 private void useDefaultTestAwContentsClient() throws Exception { | 55 private void useDefaultTestAwContentsClient() throws Exception { |
| 56 mContentsClient.enableBypass(); | 56 mContentsClient.enableBypass(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 private static class VerifyOnReceivedError2CallClient extends TestAwContents
Client { | 59 private static class VerifyOnReceivedError2CallClient extends TestAwContents
Client { |
| 60 private boolean mBypass = false; | 60 private boolean mBypass; |
| 61 private boolean mIsOnPageFinishedCalled = false; | 61 private boolean mIsOnPageFinishedCalled; |
| 62 private boolean mIsOnReceivedError2Called = false; | 62 private boolean mIsOnReceivedError2Called; |
| 63 | 63 |
| 64 void enableBypass() { | 64 void enableBypass() { |
| 65 mBypass = true; | 65 mBypass = true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 @Override | 68 @Override |
| 69 public void onPageFinished(String url) { | 69 public void onPageFinished(String url) { |
| 70 if (!mBypass) { | 70 if (!mBypass) { |
| 71 assertEquals( | 71 assertEquals( |
| 72 "onPageFinished called twice for " + url, false, mIsOnPa
geFinishedCalled); | 72 "onPageFinished called twice for " + url, false, mIsOnPa
geFinishedCalled); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 final int onReceivedError2CallCount = onReceivedError2Helper.getCallCoun
t(); | 373 final int onReceivedError2CallCount = onReceivedError2Helper.getCallCoun
t(); |
| 374 loadUrlAsync(mAwContents, BAD_HTML_URL); | 374 loadUrlAsync(mAwContents, BAD_HTML_URL); |
| 375 onReceivedError2Helper.waitForCallback(onReceivedError2CallCount, | 375 onReceivedError2Helper.waitForCallback(onReceivedError2CallCount, |
| 376 1 /* numberOfCallsToWaitFor */, | 376 1 /* numberOfCallsToWaitFor */, |
| 377 WAIT_TIMEOUT_MS, | 377 WAIT_TIMEOUT_MS, |
| 378 TimeUnit.MILLISECONDS); | 378 TimeUnit.MILLISECONDS); |
| 379 assertEquals(onReceivedError2CallCount + 1, onReceivedError2Helper.getCa
llCount()); | 379 assertEquals(onReceivedError2CallCount + 1, onReceivedError2Helper.getCa
llCount()); |
| 380 assertEquals(BAD_HTML_URL, onReceivedError2Helper.getRequest().url); | 380 assertEquals(BAD_HTML_URL, onReceivedError2Helper.getRequest().url); |
| 381 } | 381 } |
| 382 } | 382 } |
| OLD | NEW |