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.test; | 5 package org.chromium.chrome.browser.test; |
6 | 6 |
7 import android.app.AlertDialog; | 7 import android.app.AlertDialog; |
8 import android.content.DialogInterface; | 8 import android.content.DialogInterface; |
9 import android.test.suitebuilder.annotation.MediumTest; | 9 import android.test.suitebuilder.annotation.MediumTest; |
10 import android.util.Log; | 10 import android.util.Log; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 * is closed. | 276 * is closed. |
277 */ | 277 */ |
278 @MediumTest | 278 @MediumTest |
279 @Feature({"Browser", "Main"}) | 279 @Feature({"Browser", "Main"}) |
280 public void testDialogDismissedAfterClosingTab() throws InterruptedException
{ | 280 public void testDialogDismissedAfterClosingTab() throws InterruptedException
{ |
281 executeJavaScriptAndWaitForDialog("alert('Android')"); | 281 executeJavaScriptAndWaitForDialog("alert('Android')"); |
282 | 282 |
283 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 283 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
284 @Override | 284 @Override |
285 public void run() { | 285 public void run() { |
286 getActivity().closeAllTabs(); | 286 getActivity().closeTab(); |
287 } | 287 } |
288 }); | 288 }); |
289 | 289 |
290 // Closing the tab should have dismissed the dialog. | 290 // Closing the tab should have dismissed the dialog. |
291 boolean criteriaSatisfied = CriteriaHelper.pollForCriteria( | 291 boolean criteriaSatisfied = CriteriaHelper.pollForCriteria( |
292 new JavascriptAppModalDialogShownCriteria(false)); | 292 new JavascriptAppModalDialogShownCriteria(false)); |
293 assertTrue("The dialog should have been dismissed when its tab was close
d.", | 293 assertTrue("The dialog should have been dismissed when its tab was close
d.", |
294 criteriaSatisfied); | 294 criteriaSatisfied); |
295 } | 295 } |
296 | 296 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 button.getVisibility()); | 408 button.getVisibility()); |
409 assertEquals("'" + readableName + "' button has wrong text", | 409 assertEquals("'" + readableName + "' button has wrong text", |
410 getActivity().getResources().getString(expectedTextResourceId), | 410 getActivity().getResources().getString(expectedTextResourceId), |
411 button.getText().toString()); | 411 button.getText().toString()); |
412 } | 412 } |
413 | 413 |
414 private TestCallbackHelperContainer getActiveTabTestCallbackHelperContainer(
) { | 414 private TestCallbackHelperContainer getActiveTabTestCallbackHelperContainer(
) { |
415 return new TestCallbackHelperContainer(getActivity().getActiveTab().getC
ontentViewCore()); | 415 return new TestCallbackHelperContainer(getActivity().getActiveTab().getC
ontentViewCore()); |
416 } | 416 } |
417 } | 417 } |
OLD | NEW |