Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2975)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java

Issue 618553002: [Android] Move printing test to the correct package. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 306d077bbd6fa2117a19090867534c7899395f01..f2ae379c81de0019e172cee02bffb98e57c69dab 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
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.printing;
+package org.chromium.chrome.browser.printing;
import android.annotation.TargetApi;
import android.os.Build;
@@ -18,9 +18,11 @@ import org.chromium.base.ApiCompatibilityUtils;
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.printing.TabPrinter;
import org.chromium.chrome.shell.ChromeShellTab;
import org.chromium.chrome.shell.ChromeShellTestBase;
+import org.chromium.printing.PrintDocumentAdapterWrapper;
+import org.chromium.printing.PrintManagerDelegate;
+import org.chromium.printing.PrintingControllerImpl;
import java.io.File;
import java.io.FileInputStream;
@@ -92,9 +94,8 @@ public class PrintingControllerTest extends ChromeShellTestBase {
// Create a temporary file to save the PDF.
final File cacheDir = getInstrumentation().getTargetContext().getCacheDir();
final File tempFile = File.createTempFile(TEMP_FILE_NAME, TEMP_FILE_EXTENSION, cacheDir);
- final ParcelFileDescriptor fileDescriptor =
- ParcelFileDescriptor.open(tempFile, (ParcelFileDescriptor.MODE_CREATE |
- ParcelFileDescriptor.MODE_READ_WRITE));
+ final ParcelFileDescriptor fileDescriptor = ParcelFileDescriptor.open(tempFile,
+ (ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_READ_WRITE));
PrintAttributes attributes = new PrintAttributes.Builder()
.setMediaSize(PrintAttributes.MediaSize.ISO_A4)
@@ -103,26 +104,22 @@ public class PrintingControllerTest extends ChromeShellTestBase {
.build();
// Use this to wait for PDF generation to complete, as it will happen asynchronously.
- final FutureTask<Boolean> result =
- new FutureTask<Boolean>(new Callable<Boolean>() {
- @Override
- public Boolean call() {
- return true;
- }
- });
-
- callLayoutOnUiThread(
- printingController,
- null,
- attributes,
- new LayoutResultCallbackWrapperMock() {
- // Called on UI thread
+ final FutureTask<Boolean> result = new FutureTask<Boolean>(new Callable<Boolean>() {
@Override
- public void onLayoutFinished(PrintDocumentInfo info, boolean changed) {
- callWriteOnUiThread(printingController, fileDescriptor, result);
+ public Boolean call() {
+ return true;
}
});
+ callLayoutOnUiThread(printingController, null, attributes,
+ new LayoutResultCallbackWrapperMock() {
+ // Called on UI thread
+ @Override
+ public void onLayoutFinished(PrintDocumentInfo info, boolean changed) {
+ callWriteOnUiThread(printingController, fileDescriptor, result);
+ }
+ });
+
FileInputStream in = null;
try {
// This blocks until the PDF is generated.
@@ -169,8 +166,7 @@ public class PrintingControllerTest extends ChromeShellTestBase {
try {
final PrintManagerDelegate mockPrintManagerDelegate = new PrintManagerDelegate() {
@Override
- public void print(String printJobName,
- PrintDocumentAdapter documentAdapter,
+ public void print(String printJobName, PrintDocumentAdapter documentAdapter,
PrintAttributes attributes) {
// Do nothing, as we will emulate the framework call sequence within the test.
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698