1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.xwalk.core.xwview.test;
7 import android.graphics.Bitmap;
8 import android.test.suitebuilder.annotation.SmallTest;
9 import android.util.Log;
11 import org.chromium.base.test.util.Feature;
13 import org.xwalk.core.XWalkClient;
14 import org.xwalk.core.XWalkView;
15 import org.xwalk.core.XWalkWebChromeClient;
16 import org.xwalk.core.xwview.test.ExtensionEcho;
19 * Test suite for ExtensionEcho().
21 public class ExtensionEchoTest extends XWalkViewTestBase {
23 public void setUp() throws Exception {
26 class TestXWalkClient extends XWalkClient {
28 public void onPageStarted(XWalkView view, String url, Bitmap favicon) {
29 mTestContentsClient.onPageStarted(url);
33 public void onPageFinished(XWalkView view, String url) {
34 mTestContentsClient.didFinishLoad(url);
38 class TestXWalkChromeClient extends XWalkWebChromeClient {
40 public void onReceivedTitle(XWalkView view, String title) {
41 mTestContentsClient.onTitleChanged(title);
45 getInstrumentation().runOnMainSync(new Runnable() {
48 getXWalkView().setXWalkClient(new TestXWalkClient());
49 getXWalkView().setXWalkWebChromeClient(new TestXWalkChromeClient());
55 @Feature({"ExtensionEcho"})
56 public void testExtensionEcho() throws Throwable {
57 ExtensionEcho echo = new ExtensionEcho();
59 loadAssetFileAndWaitForTitle("echo.html");
60 assertEquals("Pass", getTitleOnUiThread());
64 @Feature({"ExtensionEcho"})
65 public void testExtensionEchoSync() throws Throwable {
66 ExtensionEcho echo = new ExtensionEcho();
68 loadAssetFile("echoSync.html");
69 assertEquals("Pass", getTitleOnUiThread());
73 @Feature({"ExtensionEcho"})
74 public void testExtensionEchoMultiFrames() throws Throwable {
75 ExtensionEcho echo = new ExtensionEcho();
77 loadAssetFileAndWaitForTitle("framesEcho.html");
78 assertEquals("Pass", getTitleOnUiThread());