1 // Copyright (c) 2014 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.xwalk.core.internal.xwview.test;
7 import android.test.suitebuilder.annotation.SmallTest;
9 import org.chromium.base.test.util.DisabledTest;
10 import org.chromium.base.test.util.Feature;
13 * Test suite for load().
15 public class LoadTest extends XWalkViewInternalTestBase {
16 final String expectedTitle = "The WebKit Open Source Project";
17 final String expectedLocalTitle = "Crosswalk Sample Application";
20 public void setUp() throws Exception {
24 // TODO(hengzhi): Since the device issue, it can not access the network,
25 // so disabled this test temporarily. It will be enabled later.
29 public void testHttpUrl() throws Throwable {
30 final String url = "http://www.webkit.org/";
33 assertEquals(expectedTitle, getTitleOnUiThread());
36 // TODO(hengzhi): Since the device issue, it can not access the network,
37 // so disabled this test temporarily. It will be enabled later.
41 public void testHttpsUrl() throws Throwable {
42 final String url = "https://www.webkit.org/";
45 assertEquals(expectedTitle, getTitleOnUiThread());
50 public void testAndroidAssetUrl() throws Throwable {
51 final String url = "file:///android_asset/www/index.html";
54 assertEquals(expectedLocalTitle, getTitleOnUiThread());
58 @Feature({"LoadWithData"})
59 public void testWithData() throws Throwable {
60 final String name = "index.html";
61 String fileContent = getFileContent(name);
63 loadDataSync(null, fileContent, "text/html", false);
64 assertEquals(expectedLocalTitle, getTitleOnUiThread());
66 loadDataSync(name, fileContent, "text/html", false);
67 assertEquals(expectedLocalTitle, getTitleOnUiThread());
71 @Feature({"ContentScheme"})
72 public void testContentUrl() throws Throwable {
73 final String resource = "content_test";
74 final String contentUrl = TestContentProvider.createContentUrl(resource);
77 TestContentProvider.getResourceRequestCount(getActivity(), resource);
78 loadUrlSync(contentUrl);
79 assertEquals(count + 1,
80 TestContentProvider.getResourceRequestCount(getActivity(), resource));
85 public void testEmpytUrlAndContent() throws Throwable {
86 loadDataAsync(null, null, "text/html", false);
88 assertNotNull(getTitleOnUiThread());