| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.content.DialogInterface; | 7 import android.content.DialogInterface; |
| 8 import android.support.v7.app.AlertDialog; | 8 import android.support.v7.app.AlertDialog; |
| 9 import android.test.suitebuilder.annotation.MediumTest; | 9 import android.test.suitebuilder.annotation.MediumTest; |
| 10 import android.util.Log; | 10 import android.util.Log; |
| 11 import android.view.View; | 11 import android.view.View; |
| 12 import android.widget.Button; | 12 import android.widget.Button; |
| 13 import android.widget.CheckBox; | 13 import android.widget.CheckBox; |
| 14 import android.widget.EditText; | 14 import android.widget.EditText; |
| 15 | 15 |
| 16 import org.chromium.base.ThreadUtils; | 16 import org.chromium.base.ThreadUtils; |
| 17 import org.chromium.base.test.util.Feature; | 17 import org.chromium.base.test.util.Feature; |
| 18 import org.chromium.base.test.util.RetryOnFailure; |
| 18 import org.chromium.base.test.util.UrlUtils; | 19 import org.chromium.base.test.util.UrlUtils; |
| 19 import org.chromium.chrome.R; | 20 import org.chromium.chrome.R; |
| 20 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 21 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 21 import org.chromium.content.browser.test.util.Criteria; | 22 import org.chromium.content.browser.test.util.Criteria; |
| 22 import org.chromium.content.browser.test.util.CriteriaHelper; | 23 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 23 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; | 24 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; |
| 24 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnEval
uateJavaScriptResultHelper; | 25 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnEval
uateJavaScriptResultHelper; |
| 25 | 26 |
| 26 import java.util.concurrent.Callable; | 27 import java.util.concurrent.Callable; |
| 27 import java.util.concurrent.ExecutionException; | 28 import java.util.concurrent.ExecutionException; |
| 28 import java.util.concurrent.TimeoutException; | 29 import java.util.concurrent.TimeoutException; |
| 29 | 30 |
| 30 /** | 31 /** |
| 31 * Test suite for displaying and functioning of modal dialogs. | 32 * Test suite for displaying and functioning of modal dialogs. |
| 32 */ | 33 */ |
| 34 @RetryOnFailure |
| 33 public class ModalDialogTest extends ChromeActivityTestCaseBase<ChromeActivity>
{ | 35 public class ModalDialogTest extends ChromeActivityTestCaseBase<ChromeActivity>
{ |
| 34 private static final String TAG = "ModalDialogTest"; | 36 private static final String TAG = "ModalDialogTest"; |
| 35 private static final String EMPTY_PAGE = UrlUtils.encodeHtmlDataUri( | 37 private static final String EMPTY_PAGE = UrlUtils.encodeHtmlDataUri( |
| 36 "<html><title>Modal Dialog Test</title><p>Testcase.</p></title></htm
l>"); | 38 "<html><title>Modal Dialog Test</title><p>Testcase.</p></title></htm
l>"); |
| 37 private static final String BEFORE_UNLOAD_URL = UrlUtils.encodeHtmlDataUri("
<html>" | 39 private static final String BEFORE_UNLOAD_URL = UrlUtils.encodeHtmlDataUri("
<html>" |
| 38 + "<head><script>window.onbeforeunload=function() {" | 40 + "<head><script>window.onbeforeunload=function() {" |
| 39 + "return 'Are you sure?';" | 41 + "return 'Are you sure?';" |
| 40 + "};</script></head></html>"); | 42 + "};</script></head></html>"); |
| 41 | 43 |
| 42 public ModalDialogTest() { | 44 public ModalDialogTest() { |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 button.getVisibility()); | 401 button.getVisibility()); |
| 400 assertEquals("'" + readableName + "' button has wrong text", | 402 assertEquals("'" + readableName + "' button has wrong text", |
| 401 getActivity().getResources().getString(expectedTextResourceId), | 403 getActivity().getResources().getString(expectedTextResourceId), |
| 402 button.getText().toString()); | 404 button.getText().toString()); |
| 403 } | 405 } |
| 404 | 406 |
| 405 private TestCallbackHelperContainer getActiveTabTestCallbackHelperContainer(
) { | 407 private TestCallbackHelperContainer getActiveTabTestCallbackHelperContainer(
) { |
| 406 return new TestCallbackHelperContainer(getActivity().getCurrentContentVi
ewCore()); | 408 return new TestCallbackHelperContainer(getActivity().getCurrentContentVi
ewCore()); |
| 407 } | 409 } |
| 408 } | 410 } |
| OLD | NEW |