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.app.AlertDialog; | 7 import android.app.AlertDialog; |
8 import android.test.suitebuilder.annotation.MediumTest; | 8 import android.test.suitebuilder.annotation.MediumTest; |
9 | 9 |
10 import org.chromium.base.test.util.EnormousTest; | 10 import org.chromium.base.test.util.EnormousTest; |
11 import org.chromium.base.test.util.Feature; | 11 import org.chromium.base.test.util.Feature; |
12 import org.chromium.chrome.test.util.TabBaseTabUtils; | 12 import org.chromium.chrome.test.util.TabUtils; |
13 import org.chromium.chrome.test.util.TestHttpServerClient; | 13 import org.chromium.chrome.test.util.TestHttpServerClient; |
14 import org.chromium.chrome.testshell.ChromiumTestShellTestBase; | 14 import org.chromium.chrome.testshell.ChromiumTestShellTestBase; |
15 import org.chromium.chrome.testshell.TestShellTab; | 15 import org.chromium.chrome.testshell.TestShellTab; |
16 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; | 16 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; |
17 | 17 |
18 import java.util.concurrent.TimeoutException; | 18 import java.util.concurrent.TimeoutException; |
19 | 19 |
20 /** | 20 /** |
21 * Integration tests verifying that form resubmission dialogs are correctly disp
layed and handled. | 21 * Integration tests verifying that form resubmission dialogs are correctly disp
layed and handled. |
22 */ | 22 */ |
23 public class RepostFormWarningTest extends ChromiumTestShellTestBase { | 23 public class RepostFormWarningTest extends ChromiumTestShellTestBase { |
24 // Active tab. | 24 // Active tab. |
25 private TestShellTab mTab; | 25 private TestShellTab mTab; |
26 // Callback helper that manages waiting for pageloads to finish. | 26 // Callback helper that manages waiting for pageloads to finish. |
27 private TestCallbackHelperContainer mCallbackHelper; | 27 private TestCallbackHelperContainer mCallbackHelper; |
28 | 28 |
29 @Override | 29 @Override |
30 public void setUp() throws Exception { | 30 public void setUp() throws Exception { |
31 super.setUp(); | 31 super.setUp(); |
32 | 32 |
33 mTab = launchChromiumTestShellWithBlankPage().getActiveTab(); | 33 mTab = launchChromiumTestShellWithBlankPage().getActiveTab(); |
34 mCallbackHelper = TabBaseTabUtils.getTestCallbackHelperContainer(mTab); | 34 mCallbackHelper = TabUtils.getTestCallbackHelperContainer(mTab); |
35 | 35 |
36 // Wait for the initial load of about://blank to finish. | 36 // Wait for the initial load of about://blank to finish. |
37 mCallbackHelper.getOnPageFinishedHelper().waitForCallback(0); | 37 mCallbackHelper.getOnPageFinishedHelper().waitForCallback(0); |
38 } | 38 } |
39 | 39 |
40 /** Verifies that the form resubmission warning is not displayed upon first
POST navigation. */ | 40 /** Verifies that the form resubmission warning is not displayed upon first
POST navigation. */ |
41 @MediumTest | 41 @MediumTest |
42 @Feature({"Navigation"}) | 42 @Feature({"Navigation"}) |
43 public void testFormFirstNavigation() throws Throwable { | 43 public void testFormFirstNavigation() throws Throwable { |
44 // Load the url posting data for the first time. | 44 // Load the url posting data for the first time. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 /** Clicks the given button in the given dialog. */ | 133 /** Clicks the given button in the given dialog. */ |
134 private void clickButton(final AlertDialog dialog, final int buttonId) throw
s Throwable { | 134 private void clickButton(final AlertDialog dialog, final int buttonId) throw
s Throwable { |
135 runTestOnUiThread(new Runnable() { | 135 runTestOnUiThread(new Runnable() { |
136 @Override | 136 @Override |
137 public void run() { | 137 public void run() { |
138 dialog.getButton(buttonId).performClick(); | 138 dialog.getButton(buttonId).performClick(); |
139 } | 139 } |
140 }); | 140 }); |
141 } | 141 } |
142 } | 142 } |
OLD | NEW |