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.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
8 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
9 | 9 |
10 import org.chromium.android_webview.AwContents; | 10 import org.chromium.android_webview.AwContents; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 final String page2Title = "Page2"; | 252 final String page2Title = "Page2"; |
253 final String page2Html = "<html><head><title>" + page2Title + "</tit
le>" | 253 final String page2Html = "<html><head><title>" + page2Title + "</tit
le>" |
254 + "<body>" + page2Title + "</body></html>"; | 254 + "<body>" + page2Title + "</body></html>"; |
255 | 255 |
256 final TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishe
dHelper = | 256 final TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishe
dHelper = |
257 mContentsClient.getOnPageFinishedHelper(); | 257 mContentsClient.getOnPageFinishedHelper(); |
258 loadDataSync(mAwContents, onPageFinishedHelper, page2Html, "text/htm
l", false); | 258 loadDataSync(mAwContents, onPageFinishedHelper, page2Html, "text/htm
l", false); |
259 assertEquals(page2Title, getTitleOnUiThread(mAwContents)); | 259 assertEquals(page2Title, getTitleOnUiThread(mAwContents)); |
260 | 260 |
261 HistoryUtils.goBackSync(getInstrumentation(), mWebContents, onPageFi
nishedHelper); | 261 HistoryUtils.goBackSync(getInstrumentation(), mWebContents, onPageFi
nishedHelper); |
262 // The title of first page loaded with loadDataWithBaseUrl. | 262 // The title of the 'about.html' specified via historyUrl. |
263 assertEquals(page1Title, getTitleOnUiThread(mAwContents)); | 263 assertEquals(CommonResources.ABOUT_TITLE, getTitleOnUiThread(mAwCont
ents)); |
264 } finally { | 264 } finally { |
265 webServer.shutdown(); | 265 webServer.shutdown(); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 /** | 269 /** |
270 * @return true if |fileUrl| was accessible from a data url with |baseUrl| a
s it's | 270 * @return true if |fileUrl| was accessible from a data url with |baseUrl| a
s it's |
271 * base URL. | 271 * base URL. |
272 */ | 272 */ |
273 private boolean canAccessFileFromData(String baseUrl, String fileUrl) throws
Throwable { | 273 private boolean canAccessFileFromData(String baseUrl, String fileUrl) throws
Throwable { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 mContentsClient.getOnPageFinishedHelper(); | 405 mContentsClient.getOnPageFinishedHelper(); |
406 final int callCount = onPageFinishedHelper.getCallCount(); | 406 final int callCount = onPageFinishedHelper.getCallCount(); |
407 getAwSettingsOnUiThread(mAwContents).setJavaScriptEnabled(true); | 407 getAwSettingsOnUiThread(mAwContents).setJavaScriptEnabled(true); |
408 loadDataWithBaseUrlAsync(mAwContents, pageHtml, "text/html", false, inva
lidBaseUrl, null); | 408 loadDataWithBaseUrlAsync(mAwContents, pageHtml, "text/html", false, inva
lidBaseUrl, null); |
409 loadUrlAsync(mAwContents, "javascript:42"); | 409 loadUrlAsync(mAwContents, "javascript:42"); |
410 onPageFinishedHelper.waitForCallback(callCount); | 410 onPageFinishedHelper.waitForCallback(callCount); |
411 // Verify that the load succeeds. The actual base url is undefined. | 411 // Verify that the load succeeds. The actual base url is undefined. |
412 assertEquals(CommonResources.ABOUT_TITLE, getTitleOnUiThread(mAwContents
)); | 412 assertEquals(CommonResources.ABOUT_TITLE, getTitleOnUiThread(mAwContents
)); |
413 } | 413 } |
414 } | 414 } |
OLD | NEW |