| Index: chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java
|
| index ba24fcd22e2ff8a68640eef1099eb28ecc69fbd3..fcc396a1605289156e264d141b1db103b634e12a 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java
|
| @@ -13,14 +13,19 @@
|
| import android.print.PrintDocumentAdapter;
|
| import android.print.PrintDocumentInfo;
|
| import android.test.suitebuilder.annotation.LargeTest;
|
| +import android.test.suitebuilder.annotation.SmallTest;
|
|
|
| import org.chromium.base.ApiCompatibilityUtils;
|
| +import org.chromium.base.test.util.CommandLineFlags;
|
| import org.chromium.base.test.util.Feature;
|
| import org.chromium.base.test.util.TestFileUtil;
|
| import org.chromium.base.test.util.UrlUtils;
|
| import org.chromium.chrome.browser.ChromeActivity;
|
| +import org.chromium.chrome.browser.ChromeSwitches;
|
| import org.chromium.chrome.browser.tab.Tab;
|
| import org.chromium.chrome.test.ChromeActivityTestCaseBase;
|
| +import org.chromium.chrome.test.util.browser.TabTitleObserver;
|
| +import org.chromium.content.common.ContentSwitches;
|
| import org.chromium.printing.PrintDocumentAdapterWrapper;
|
| import org.chromium.printing.PrintManagerDelegate;
|
| import org.chromium.printing.PrintingControllerImpl;
|
| @@ -150,6 +155,31 @@ public void onLayoutFinished(PrintDocumentInfo info, boolean changed) {
|
|
|
| }
|
|
|
| + /**
|
| + * Test for http://crbug.com/528909
|
| + */
|
| + @CommandLineFlags.Add(
|
| + {ContentSwitches.DISABLE_POPUP_BLOCKING, ChromeSwitches.DISABLE_DOCUMENT_MODE})
|
| + @SmallTest
|
| + @Feature({"Printing"})
|
| + public void testPrintClosedWindow() throws Throwable {
|
| + String html = "<html><head><title>printwindowclose</title></head><body><script>"
|
| + + "function printClosedWindow() {"
|
| + + " w = window.open(); w.close();"
|
| + + " setTimeout(()=>{w.print(); document.title='completed'}, 0);"
|
| + + "}</script></body></html>";
|
| +
|
| + startMainActivityWithURL("data:text/html;charset=utf-8," + html);
|
| +
|
| + Tab mTab = getActivity().getActivityTab();
|
| + assertEquals("title does not match initial title", "printwindowclose", mTab.getTitle());
|
| +
|
| + TabTitleObserver mOnTitleUpdatedHelper = new TabTitleObserver(mTab, "completed");
|
| + runJavaScriptCodeInCurrentTab("printClosedWindow();");
|
| + mOnTitleUpdatedHelper.waitForTitleUpdate(2);
|
| + assertEquals("JS did not finish running", "completed", mTab.getTitle());
|
| + }
|
| +
|
| private PrintingControllerImpl createControllerOnUiThread() {
|
| try {
|
| final FutureTask<PrintingControllerImpl> task =
|
|
|