Upstream version 6.35.131.0
[platform/framework/web/crosswalk.git] / src / xwalk / test / android / core / javatests / src / org / xwalk / core / xwview / test / ReloadTest.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
11 import org.chromium.base.test.util.DisabledTest;
12 import org.chromium.base.test.util.Feature;
13 import org.chromium.net.test.util.TestWebServer;
14 import org.xwalk.core.XWalkClient;
15 import org.xwalk.core.XWalkView;
16
17 /**
18  * Test suite for reload().
19  */
20 public class ReloadTest extends XWalkViewTestBase {
21
22     private TestWebServer mWebServer;
23
24     @Override
25     public void setUp() throws Exception {
26         super.setUp();
27
28         setXWalkClient(new XWalkViewTestBase.TestXWalkClient());
29         mWebServer = new TestWebServer(false);
30     }
31
32     @Override
33     public void tearDown() throws Exception {
34         if (mWebServer != null) {
35             mWebServer.shutdown();
36         }
37         super.tearDown();
38     }
39
40     // TODO(guangzhen): Since the device issue, it can not access the network,
41     // so disabled this test temporarily. It will be enabled later.
42     // @SmallTest
43     // @Feature({"reload"})
44     @DisabledTest
45     public void testReloadUrl() throws Throwable {
46         /*
47         String title1 = "title1";
48         String title2 = "title2";
49         String html1 = "<html><head><title>" + title1 + "</title></head></html><body></body>";
50         String html2 = "<html><head><title>" + title2 + "</title></head></html><body></body>";
51         String url = mWebServer.setResponse("/reload.html", html1, null);
52         loadUrlSync(url);
53         mWebServer.setResponse("/reload.html", html2, null);
54         reloadSync(XWalkView.RELOAD_IGNORE_CACHE);
55         //TODO(guangzhen) When reload finished, immediately call getTitle will get wrong title.
56         Thread.sleep(1000);
57         assertEquals(title2, getTitleOnUiThread());
58         */
59     }
60 }