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.runtime;
7 import android.content.Context;
9 import java.lang.reflect.Method;
11 import org.xwalk.core.client.XWalkDefaultWebChromeClient;
12 import org.xwalk.core.XWalkView;
14 public class XWalkWebChromeClientForTest extends XWalkDefaultWebChromeClient{
15 private Object mCallbackForTest;
17 public XWalkWebChromeClientForTest(Context context, XWalkView view) {
21 public void setCallbackForTest(Object callback) {
22 mCallbackForTest = callback;
26 public void onReceivedTitle(XWalkView view, String title) {
27 if (mCallbackForTest != null) {
29 Class<?> objectClass = mCallbackForTest.getClass();
30 Method onReceivedTitle = objectClass.getMethod("onReceivedTitle", String.class);
31 onReceivedTitle.invoke(mCallbackForTest, title);
32 } catch (Exception e) {