1 // Copyright (c) 2014 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.os.Message;
9 import android.test.suitebuilder.annotation.SmallTest;
10 import android.util.Log;
12 import org.chromium.base.test.util.DisabledTest;
13 import org.chromium.base.test.util.Feature;
14 import org.xwalk.core.XWalkUIClient;
15 import org.xwalk.core.XWalkView;
18 * Test suite for OnReceivedIcon().
20 public class OnReceivedIconTest extends XWalkViewTestBase {
21 private TestHelperBridge.OnReceivedIconHelper mOnReceivedIconHelper;
24 public void setUp() throws Exception {
27 mOnReceivedIconHelper = mTestHelperBridge.getOnReceivedIconHelper();
29 setUIClient(new XWalkUIClient(getXWalkView()){
31 public void onIconAvailable(XWalkView view, String url, Message msg) {
32 Log.d("XWalkView", "onIconAvailable");
37 public void onReceivedIcon(XWalkView view, String url, Bitmap icon) {
38 Log.d("XWalkView", "onReceivedIcon");
39 mOnReceivedIconHelper.notifyCalled(icon);
45 public void testOnReceivedIcon() throws Throwable {
46 String fileContent = getFileContent("favicon.html");
47 int count = mOnReceivedIconHelper.getCallCount();
49 loadDataAsync(null, fileContent, "text/html", false);
50 mOnReceivedIconHelper.waitForCallback(count);
51 assertNotNull(mOnReceivedIconHelper.getIcon());