1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Copyright (c) 2014 Intel Corporation. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
6 package org.xwalk.core.xwview.test;
8 import android.test.suitebuilder.annotation.SmallTest;
10 import org.chromium.base.test.util.DisabledTest;
11 import org.chromium.base.test.util.Feature;
14 * Test suite for load().
16 public class LoadTest extends XWalkViewTestBase {
17 final String expectedTitle = "The WebKit Open Source Project";
18 final String expectedLocalTitle = "Crosswalk Sample Application";
21 public void setUp() throws Exception {
25 // TODO(hengzhi): Since the device issue, it can not access the network,
26 // so disabled this test temporarily. It will be enabled later.
30 public void testHttpUrl() throws Throwable {
31 final String url = "http://www.webkit.org/";
34 assertEquals(expectedTitle, getTitleOnUiThread());
37 // TODO(hengzhi): Since the device issue, it can not access the network,
38 // so disabled this test temporarily. It will be enabled later.
42 public void testHttpsUrl() throws Throwable {
43 final String url = "https://www.webkit.org/";
46 assertEquals(expectedTitle, getTitleOnUiThread());
51 public void testAndroidAssetUrl() throws Throwable {
52 final String url = "file:///android_asset/www/index.html";
55 assertEquals(expectedLocalTitle, getTitleOnUiThread());
59 @Feature({"LoadWithData"})
60 public void testWithData() throws Throwable {
61 final String name = "index.html";
62 String fileContent = getFileContent(name);
64 loadDataSync(null, fileContent, "text/html", false);
65 assertEquals(expectedLocalTitle, getTitleOnUiThread());
67 loadDataSync(name, fileContent, "text/html", false);
68 assertEquals(expectedLocalTitle, getTitleOnUiThread());
72 @Feature({"ContentScheme"})
73 public void testContentUrl() throws Throwable {
74 final String resource = "content_test";
75 final String contentUrl = TestContentProvider.createContentUrl(resource);
78 TestContentProvider.getResourceRequestCount(getActivity(), resource);
79 loadUrlSync(contentUrl);
80 assertEquals(count + 1,
81 TestContentProvider.getResourceRequestCount(getActivity(), resource));
86 public void testEmpytUrlAndContent() throws Throwable {
87 loadDataAsync(null, null, "text/html", false);
89 assertNotNull(getTitleOnUiThread());