From 1106fd33d15b3e4e65d1e48b4b402d7e5b774133 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Tue, 25 Feb 2014 13:35:41 +0100 Subject: [PATCH] Backed out changeset efa293b98893 (bug 975792) for frequent failures on a CLOSED TREE --- .../base/tests/testBrowserProvider.java | 73 +------------------ 1 file changed, 1 insertion(+), 72 deletions(-) diff --git a/mobile/android/base/tests/testBrowserProvider.java b/mobile/android/base/tests/testBrowserProvider.java index 47364456a46..a2aa8e0d6c7 100644 --- a/mobile/android/base/tests/testBrowserProvider.java +++ b/mobile/android/base/tests/testBrowserProvider.java @@ -13,6 +13,7 @@ import android.util.Log; import java.util.ArrayList; import java.util.Random; +import org.mozilla.gecko.background.db.CursorDumper; import org.mozilla.gecko.db.BrowserContract; /* @@ -1868,76 +1869,4 @@ public class testBrowserProvider extends ContentProviderTest { c.close(); } } - - /** - * Pilfered from Android Background Services code. - */ - public static class CursorDumper { - protected static String fixedWidth(int width, String s) { - if (s == null) { - return spaces(width); - } - int length = s.length(); - if (width == length) { - return s; - } - if (width > length) { - return s + spaces(width - length); - } - return s.substring(0, width); - } - - protected static String spaces(int i) { - return " ".substring(0, i); - } - - protected static String dashes(int i) { - return "-------------------------------------".substring(0, i); - } - - public static void dumpCursor(Cursor cursor) { - dumpCursor(cursor, 18, "records"); - } - - protected static void dumpCursor(Cursor cursor, int columnWidth, - String tags) { - int originalPosition = cursor.getPosition(); - try { - String[] columnNames = cursor.getColumnNames(); - int columnCount = cursor.getColumnCount(); - - for (int i = 0; i < columnCount; ++i) { - System.out.print(fixedWidth(columnWidth, columnNames[i]) + - " | "); - } - System.out.println("(" + cursor.getCount() + " " + tags + ")"); - for (int i = 0; i < columnCount; ++i) { - System.out.print(dashes(columnWidth) + " | "); - } - System.out.println(""); - if (!cursor.moveToFirst()) { - System.out.println("EMPTY"); - return; - } - - cursor.moveToFirst(); - while (!cursor.isAfterLast()) { - for (int i = 0; i < columnCount; ++i) { - System.out.print(fixedWidth(columnWidth, - cursor.getString(i)) + - " | "); - } - System.out.println(""); - cursor.moveToNext(); - } - for (int i = 0; i < columnCount - 1; ++i) { - System.out.print(dashes(columnWidth + 3)); - } - System.out.print(dashes(columnWidth + 3 - 1)); - System.out.println(""); - } finally { - cursor.moveToPosition(originalPosition); - } - } - } }