| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.AndroidProtocolHandler; | 10 import org.chromium.android_webview.AndroidProtocolHandler; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 assertEquals(historyUrl, HistoryUtils.getUrlOnUiThread( | 207 assertEquals(historyUrl, HistoryUtils.getUrlOnUiThread( |
| 208 getInstrumentation(), mContentViewCore)); | 208 getInstrumentation(), mContentViewCore)); |
| 209 | 209 |
| 210 loadDataWithBaseUrlSync(pageHtml, "text/html", false, baseUrl, null); | 210 loadDataWithBaseUrlSync(pageHtml, "text/html", false, baseUrl, null); |
| 211 assertEquals("about:blank", HistoryUtils.getUrlOnUiThread( | 211 assertEquals("about:blank", HistoryUtils.getUrlOnUiThread( |
| 212 getInstrumentation(), mContentViewCore)); | 212 getInstrumentation(), mContentViewCore)); |
| 213 } | 213 } |
| 214 | 214 |
| 215 @SmallTest | 215 @SmallTest |
| 216 @Feature({"AndroidWebView"}) | 216 @Feature({"AndroidWebView"}) |
| 217 public void testOnPageFinishedUrlIsBaseUrl() throws Throwable { |
| 218 final String pageHtml = "<html><body>Hello, world!</body></html>"; |
| 219 final String baseUrl = "http://example.com/"; |
| 220 loadDataWithBaseUrlSync(pageHtml, "text/html", false, baseUrl, baseUrl); |
| 221 loadDataWithBaseUrlSync(pageHtml, "text/html", false, baseUrl, baseUrl); |
| 222 TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishedHelper = |
| 223 mContentsClient.getOnPageFinishedHelper(); |
| 224 assertEquals(baseUrl, onPageFinishedHelper.getUrl()); |
| 225 } |
| 226 |
| 227 @SmallTest |
| 228 @Feature({"AndroidWebView"}) |
| 217 public void testHistoryUrlIgnoredWithDataSchemeBaseUrl() throws Throwable { | 229 public void testHistoryUrlIgnoredWithDataSchemeBaseUrl() throws Throwable { |
| 218 final String pageHtml = "<html><body>bar</body></html>"; | 230 final String pageHtml = "<html><body>bar</body></html>"; |
| 219 final String historyUrl = "http://history.com/"; | 231 final String historyUrl = "http://history.com/"; |
| 220 loadDataWithBaseUrlSync(pageHtml, "text/html", false, "data:foo", histor
yUrl); | 232 loadDataWithBaseUrlSync(pageHtml, "text/html", false, "data:foo", histor
yUrl); |
| 221 assertEquals("data:text/html," + pageHtml, HistoryUtils.getUrlOnUiThread
( | 233 assertEquals("data:text/html," + pageHtml, HistoryUtils.getUrlOnUiThread
( |
| 222 getInstrumentation(), mContentViewCore)); | 234 getInstrumentation(), mContentViewCore)); |
| 223 } | 235 } |
| 224 | 236 |
| 225 /* | 237 /* |
| 226 @SmallTest | 238 @SmallTest |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 "file:///android_asset/asset_icon.png?" + token)); | 357 "file:///android_asset/asset_icon.png?" + token)); |
| 346 assertTrue(canAccessFileFromData(NON_DATA_BASE_URL, | 358 assertTrue(canAccessFileFromData(NON_DATA_BASE_URL, |
| 347 "file:///android_res/raw/resource_icon.png?" + token)); | 359 "file:///android_res/raw/resource_icon.png?" + token)); |
| 348 assertTrue(canAccessFileFromData(NON_DATA_BASE_URL, | 360 assertTrue(canAccessFileFromData(NON_DATA_BASE_URL, |
| 349 "file://" + imagePath + "?" + token)); | 361 "file://" + imagePath + "?" + token)); |
| 350 } finally { | 362 } finally { |
| 351 if (!tempImage.delete()) throw new AssertionError(); | 363 if (!tempImage.delete()) throw new AssertionError(); |
| 352 } | 364 } |
| 353 } | 365 } |
| 354 } | 366 } |
| OLD | NEW |