Upstream version 6.35.131.0
[platform/framework/web/crosswalk.git] / src / xwalk / test / android / core / javatests / src / org / xwalk / core / xwview / test / LoadUrlTest.java
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Copyright (c) 2013 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.
5
6 package org.xwalk.core.xwview.test;
7
8 import android.graphics.Bitmap;
9 import android.test.suitebuilder.annotation.SmallTest;
10 import android.util.Log;
11
12 import org.chromium.base.test.util.DisabledTest;
13 import org.chromium.base.test.util.Feature;
14
15 /**
16  * Test suite for loadUrl().
17  */
18 public class LoadUrlTest extends XWalkViewTestBase {
19     @Override
20     public void setUp() throws Exception {
21         super.setUp();
22
23         setXWalkClient(new XWalkViewTestBase.TestXWalkClient());
24     }
25
26     // @SmallTest
27     // @Feature({"LoadUrl"})
28     // TODO(hengzhi): Since the device issue, it can not access the network,
29     // so disabled this test temporarily. It will be enabled later.
30     @DisabledTest
31     public void testNormalUrl() throws Throwable {
32         final String url = "http://www.webkit.org/";
33         final String expected_title = "The WebKit Open Source Project";
34         loadUrlSync(url);
35         assertEquals(expected_title, getTitleOnUiThread());
36     }
37
38     @SmallTest
39     @Feature({"LoadUrl"})
40     public void testLocalUrl() throws Throwable {
41         final String name = "index.html";
42         final String expected_title = "Crosswalk Sample Application";
43
44         loadAssetFile(name);
45         assertEquals(expected_title, getTitleOnUiThread());
46     }
47
48     @SmallTest
49     @Feature({"ContentScheme"})
50     public void testContentUrl() throws Throwable {
51         final String resource = "content_test";
52         final String content_url = TestContentProvider.createContentUrl(resource);
53
54         int count_before_load =
55                 TestContentProvider.getResourceRequestCount(getActivity(), resource);
56         loadUrlSync(content_url);
57         assertEquals(count_before_load + 1,
58                 TestContentProvider.getResourceRequestCount(getActivity(), resource));
59     } 
60 }