Upstream version 10.38.217.0
[platform/framework/web/crosswalk.git] / src / xwalk / test / android / core / javatests / src / org / xwalk / core / xwview / test / OnJavascriptModalDialogTest.java
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.
4
5 package org.xwalk.core.xwview.test;
6
7 import android.test.suitebuilder.annotation.SmallTest;
8
9 import org.chromium.base.test.util.Feature;
10
11 /**
12  * Test suite for OnJavascriptModalDialog().
13  */
14 public class OnJavascriptModalDialogTest extends XWalkViewTestBase {
15     private TestHelperBridge.OnJavascriptModalDialogHelper mOnJavascriptModalDialogHelper;
16
17     @Override
18     public void setUp() throws Exception {
19         super.setUp();
20         mOnJavascriptModalDialogHelper = mTestHelperBridge.getOnJavascriptModalDialogHelper();
21     }
22
23     @SmallTest
24     @Feature({"OnJavascriptModalDialog"})
25     public void testOnJavascriptModalDialog() throws Throwable {
26         final String url = "js_modal_dialog.html";
27         String fileContent = getFileContent(url);
28         int count = mOnJavascriptModalDialogHelper.getCallCount();
29
30         loadDataSync(null, fileContent, "text/html", false);
31         clickOnElementId("js_modal_dialog", null);
32         mOnJavascriptModalDialogHelper.waitForCallback(count);
33         assertEquals("hello", mOnJavascriptModalDialogHelper.getMessage());
34     }
35 }