Upstream version 8.36.155.0
[platform/framework/web/crosswalk.git] / src / xwalk / test / android / core / javatests / src / org / xwalk / core / xwview / test / XWalkViewTestBase.java
index be87af5..a7dfc0e 100644 (file)
@@ -27,6 +27,7 @@ import org.chromium.content.browser.test.util.CriteriaHelper;
 
 import org.xwalk.core.XWalkClient;
 import org.xwalk.core.XWalkNavigationHistory;
+import org.xwalk.core.XWalkNavigationItem;
 import org.xwalk.core.XWalkResourceClient;
 import org.xwalk.core.XWalkSettings;
 import org.xwalk.core.XWalkView;
@@ -467,6 +468,42 @@ public class XWalkViewTestBase
         });
     }
 
+    protected int historySizeOnUiThread() throws Throwable {
+        return runTestOnUiThreadAndGetResult(new Callable<Integer>() {
+            @Override
+            public Integer call() {
+                return mXWalkView.getNavigationHistory().size();
+            }
+        });
+    }
+
+    protected boolean hasItemAtOnUiThread(final int index) throws Throwable {
+        return runTestOnUiThreadAndGetResult(new Callable<Boolean>() {
+            @Override
+            public Boolean call() {
+                return mXWalkView.getNavigationHistory().hasItemAt(index);
+            }
+        });
+    }
+
+    protected XWalkNavigationItem getItemAtOnUiThread(final int index) throws Throwable {
+        return runTestOnUiThreadAndGetResult(new Callable<XWalkNavigationItem>() {
+            @Override
+            public XWalkNavigationItem call() {
+                return mXWalkView.getNavigationHistory().getItemAt(index);
+            }
+        });
+    }
+
+    protected XWalkNavigationItem getCurrentItemOnUiThread() throws Throwable {
+        return runTestOnUiThreadAndGetResult(new Callable<XWalkNavigationItem>() {
+            @Override
+            public XWalkNavigationItem call() {
+                return mXWalkView.getNavigationHistory().getCurrentItem();
+            }
+        });
+    }
+
     protected String executeJavaScriptAndWaitForResult(final String code) throws Exception {
 
         final TestHelperBridge.OnEvaluateJavaScriptResultHelper helper =
@@ -520,4 +557,22 @@ public class XWalkViewTestBase
             }
         });
     }
+
+    protected String getAPIVersionOnUiThread() throws Exception {
+        return runTestOnUiThreadAndGetResult(new Callable<String>() {
+            @Override
+            public String call() throws Exception {
+                return mXWalkView.getAPIVersion();
+            }
+        });
+    }
+
+    protected String getXWalkVersionOnUiThread() throws Exception {
+        return runTestOnUiThreadAndGetResult(new Callable<String>() {
+            @Override
+            public String call() throws Exception {
+                return mXWalkView.getXWalkVersion();
+            }
+        });
+    }
 }