| 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.support.test.filters.MediumTest; | 7 import android.support.test.filters.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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 if (useBaseUrl) { | 257 if (useBaseUrl) { |
| 258 loadDataWithBaseUrlSync(mAwContents, onPageFinishedHelper, | 258 loadDataWithBaseUrlSync(mAwContents, onPageFinishedHelper, |
| 259 testHtml, "text/html", false, webServer.getBaseUrl(), nu
ll); | 259 testHtml, "text/html", false, webServer.getBaseUrl(), nu
ll); |
| 260 } else { | 260 } else { |
| 261 loadUrlSync(mAwContents, onPageFinishedHelper, testUrl); | 261 loadUrlSync(mAwContents, onPageFinishedHelper, testUrl); |
| 262 } | 262 } |
| 263 | 263 |
| 264 int onPageFinishedCallCount = onPageFinishedHelper.getCallCount(); | 264 int onPageFinishedCallCount = onPageFinishedHelper.getCallCount(); |
| 265 int onPageStartedCallCount = onPageStartedHelper.getCallCount(); | 265 int onPageStartedCallCount = onPageStartedHelper.getCallCount(); |
| 266 | 266 |
| 267 JSUtils.clickOnLinkUsingJs(this, mAwContents, | 267 JSUtils.clickOnLinkUsingJs(getInstrumentation(), mAwContents, |
| 268 mContentsClient.getOnEvaluateJavaScriptResultHelper(), "link
"); | 268 mContentsClient.getOnEvaluateJavaScriptResultHelper(), "link
"); |
| 269 | 269 |
| 270 onPageFinishedHelper.waitForCallback(onPageFinishedCallCount); | 270 onPageFinishedHelper.waitForCallback(onPageFinishedCallCount); |
| 271 assertEquals(onPageStartedCallCount, onPageStartedHelper.getCallCoun
t()); | 271 assertEquals(onPageStartedCallCount, onPageStartedHelper.getCallCoun
t()); |
| 272 | 272 |
| 273 onPageFinishedCallCount = onPageFinishedHelper.getCallCount(); | 273 onPageFinishedCallCount = onPageFinishedHelper.getCallCount(); |
| 274 onPageStartedCallCount = onPageStartedHelper.getCallCount(); | 274 onPageStartedCallCount = onPageStartedHelper.getCallCount(); |
| 275 | 275 |
| 276 executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, | 276 executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, |
| 277 "window.history.go(-1)"); | 277 "window.history.go(-1)"); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 // Our load isn't done since we haven't loaded the image - now cance
l the load. | 534 // Our load isn't done since we haven't loaded the image - now cance
l the load. |
| 535 stopLoading(mAwContents); | 535 stopLoading(mAwContents); |
| 536 onPageFinishedHelper.waitForCallback(0); | 536 onPageFinishedHelper.waitForCallback(0); |
| 537 assertEquals(1, onPageFinishedHelper.getCallCount()); | 537 assertEquals(1, onPageFinishedHelper.getCallCount()); |
| 538 } finally { | 538 } finally { |
| 539 testDoneLatch.countDown(); | 539 testDoneLatch.countDown(); |
| 540 webServer.shutdown(); | 540 webServer.shutdown(); |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 } | 543 } |
| OLD | NEW |