Upstream version 7.35.138.0
[platform/framework/web/crosswalk.git] / src / xwalk / test / android / core / javatests / src / org / xwalk / core / xwview / test / GetTitleTest.java
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.
5
6 package org.xwalk.core.xwview.test;
7
8 import android.test.suitebuilder.annotation.SmallTest;
9
10 import org.chromium.base.test.util.Feature;
11
12 /**
13  * Test suite for getTitle().
14  */
15 public class GetTitleTest extends XWalkViewTestBase {
16     final String mTitle = "Crosswalk Sample Application";
17
18     @Override
19     public void setUp() throws Exception {
20         super.setUp();
21
22         setXWalkClient(new XWalkViewTestBase.TestXWalkClient());
23     }
24
25     @SmallTest
26     @Feature({"GetTitle"})
27     public void testGetTitle() throws Throwable {
28         final String url = "file:///android_asset/www/index.html";
29
30         loadUrlSync(url);
31         assertEquals(mTitle, getTitleOnUiThread());
32     }
33
34     @SmallTest
35     @Feature({"GetTitle"})
36     public void testGetTitleWithData() throws Throwable {
37         final String name = "index.html";
38         final String fileContent = getFileContent(name);
39
40         loadDataSync(name, fileContent, "text/html", false);
41         assertEquals(mTitle, getTitleOnUiThread());
42     }
43 }