| 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.printing; | 5 package org.chromium.chrome.browser.printing; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.os.CancellationSignal; | 9 import android.os.CancellationSignal; |
| 10 import android.os.ParcelFileDescriptor; | 10 import android.os.ParcelFileDescriptor; |
| 11 import android.print.PageRange; | 11 import android.print.PageRange; |
| 12 import android.print.PrintAttributes; | 12 import android.print.PrintAttributes; |
| 13 import android.print.PrintDocumentAdapter; | 13 import android.print.PrintDocumentAdapter; |
| 14 import android.print.PrintDocumentInfo; | 14 import android.print.PrintDocumentInfo; |
| 15 import android.test.suitebuilder.annotation.LargeTest; | 15 import android.test.suitebuilder.annotation.LargeTest; |
| 16 | 16 |
| 17 import org.chromium.base.ApiCompatibilityUtils; | 17 import org.chromium.base.ApiCompatibilityUtils; |
| 18 import org.chromium.base.test.util.CommandLineFlags; | 18 import org.chromium.base.test.util.CommandLineFlags; |
| 19 import org.chromium.base.test.util.DisabledTest; | 19 import org.chromium.base.test.util.DisabledTest; |
| 20 import org.chromium.base.test.util.Feature; | 20 import org.chromium.base.test.util.Feature; |
| 21 import org.chromium.base.test.util.TestFileUtil; | 21 import org.chromium.base.test.util.TestFileUtil; |
| 22 import org.chromium.base.test.util.UrlUtils; | 22 import org.chromium.base.test.util.UrlUtils; |
| 23 import org.chromium.chrome.browser.ChromeActivity; | 23 import org.chromium.chrome.browser.ChromeActivity; |
| 24 import org.chromium.chrome.browser.ChromeSwitches; | |
| 25 import org.chromium.chrome.browser.tab.Tab; | 24 import org.chromium.chrome.browser.tab.Tab; |
| 26 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 25 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 27 import org.chromium.chrome.test.util.browser.TabTitleObserver; | 26 import org.chromium.chrome.test.util.browser.TabTitleObserver; |
| 28 import org.chromium.content.common.ContentSwitches; | 27 import org.chromium.content.common.ContentSwitches; |
| 29 import org.chromium.printing.PrintDocumentAdapterWrapper; | 28 import org.chromium.printing.PrintDocumentAdapterWrapper; |
| 30 import org.chromium.printing.PrintManagerDelegate; | 29 import org.chromium.printing.PrintManagerDelegate; |
| 31 import org.chromium.printing.PrintingControllerImpl; | 30 import org.chromium.printing.PrintingControllerImpl; |
| 32 | 31 |
| 33 import java.io.File; | 32 import java.io.File; |
| 34 import java.io.FileInputStream; | 33 import java.io.FileInputStream; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 154 |
| 156 } | 155 } |
| 157 | 156 |
| 158 /** | 157 /** |
| 159 * Test for http://crbug.com/528909 | 158 * Test for http://crbug.com/528909 |
| 160 * | 159 * |
| 161 * Bug: http://crbug.com/532652 | 160 * Bug: http://crbug.com/532652 |
| 162 * @SmallTest | 161 * @SmallTest |
| 163 * @Feature({"Printing"}) | 162 * @Feature({"Printing"}) |
| 164 */ | 163 */ |
| 165 @CommandLineFlags.Add( | 164 @CommandLineFlags.Add(ContentSwitches.DISABLE_POPUP_BLOCKING) |
| 166 {ContentSwitches.DISABLE_POPUP_BLOCKING, ChromeSwitches.DISABLE_DOCU
MENT_MODE}) | |
| 167 @DisabledTest | 165 @DisabledTest |
| 168 public void testPrintClosedWindow() throws Throwable { | 166 public void testPrintClosedWindow() throws Throwable { |
| 169 if (!ApiCompatibilityUtils.isPrintingSupported()) return; | 167 if (!ApiCompatibilityUtils.isPrintingSupported()) return; |
| 170 | 168 |
| 171 String html = "<html><head><title>printwindowclose</title></head><body><
script>" | 169 String html = "<html><head><title>printwindowclose</title></head><body><
script>" |
| 172 + "function printClosedWindow() {" | 170 + "function printClosedWindow() {" |
| 173 + " w = window.open(); w.close();" | 171 + " w = window.open(); w.close();" |
| 174 + " setTimeout(()=>{w.print(); document.title='completed'}, 0);
" | 172 + " setTimeout(()=>{w.print(); document.title='completed'}, 0);
" |
| 175 + "}</script></body></html>"; | 173 + "}</script></body></html>"; |
| 176 | 174 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 @Override | 295 @Override |
| 298 public void run() { | 296 public void run() { |
| 299 controller.onFinish(); | 297 controller.onFinish(); |
| 300 } | 298 } |
| 301 }); | 299 }); |
| 302 } catch (Throwable e) { | 300 } catch (Throwable e) { |
| 303 fail("Error on calling onFinish of PrintingControllerImpl " + e); | 301 fail("Error on calling onFinish of PrintingControllerImpl " + e); |
| 304 } | 302 } |
| 305 } | 303 } |
| 306 } | 304 } |
| OLD | NEW |