diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2013-01-11 21:59:09 +0100 |
---|---|---|
committer | Jorge Ruesga <jorge@ruesga.com> | 2013-01-12 12:58:48 +0100 |
commit | 7322527bac3f3de9692475948c760d1543459405 (patch) | |
tree | 20bb91d837cabb2100a486bd3289d246d365b7e3 /tests/src/com/cyanogenmod/filemanager | |
parent | 995e39a70e2bb091a47447a6dfdd606dd1b999df (diff) | |
download | android_packages_apps_CMFileManager-7322527bac3f3de9692475948c760d1543459405.tar.gz android_packages_apps_CMFileManager-7322527bac3f3de9692475948c760d1543459405.tar.bz2 android_packages_apps_CMFileManager-7322527bac3f3de9692475948c760d1543459405.zip |
CMFM: Sync jellybean with upstreamjellybean
Added missing hungarian translation Tamás Tóth http://review.cyanogenmod.org/29947
CMFileManager: fixed typo in romanian tran Igor Sorocean http://review.cyanogenmod.org/29974
CMFM: Fix typo Jorge Ruesga http://review.cyanogenmod.org/29984
CMFM: Do not use cd and pwd commands Jorge Ruesga http://review.cyanogenmod.org/29921
CMFileManager: Dutch translations Marco Brohet http://review.cyanogenmod.org/29801
CMFM: Ignore stderr from stat list command Jorge Ruesga http://review.cyanogenmod.org/29920
CMFM: Fix race condition Jorge Ruesga http://review.cyanogenmod.org/29919
CMFM: Read hidden files with new stat list Jorge Ruesga http://review.cyanogenmod.org/29849
CMFM: Fix FC caused by accessing ui outsid Jorge Ruesga http://review.cyanogenmod.org/29842
CMFM: Fix AsyncResultProgram deadlock Jorge Ruesga http://review.cyanogenmod.org/29841
CMFM: es_ES - update missing translations Jorge Ruesga http://review.cyanogenmod.org/29802
CMFM: Fix sync object Jorge Ruesga http://review.cyanogenmod.org/29777
CMFM: Fix NPE when parent dir is null Jorge Ruesga http://review.cyanogenmod.org/29775
CMFM: Fix navigation view fade effect Jorge Ruesga http://review.cyanogenmod.org/29762
CMFM: Display new fso datetimes props Jorge Ruesga http://review.cyanogenmod.org/29757
CMFM: Use filesystem type instead of auto Jorge Ruesga http://review.cyanogenmod.org/29763
CMFileManager: Dutch translations Marco Brohet http://review.cyanogenmod.org/29731
CMFM: Fix filesystem and fso dialog layout Jorge Ruesga http://review.cyanogenmod.org/29738
CMFM: Fix name and parent for root directo Jorge Ruesga http://review.cyanogenmod.org/29737
CMFM: Fixes and Improvements Jorge Ruesga http://review.cyanogenmod.org/29679
Update Russian Translation-CMFileManager-C Pavel Volkov http://review.cyanogenmod.org/29644
Add mime type for exported settings of K9. Danny Baumann http://review.cyanogenmod.org/29622
Fall back to showing all files for unknown Danny Baumann http://review.cyanogenmod.org/29621
PT-BR: Fixes to translation Gustavo Rosa http://review.cyanogenmod.org/29612
CMFileManager: Updated menu strings to red Roman Barczynski http://review.cyanogenmod.org/29563
CMFileManager: Dutch translations Marco Brohet http://review.cyanogenmod.org/29249
CMFileManager: Add RealVideo and Matroska Jorge Ruesga http://review.cyanogenmod.org/28968
Fix german translation for disk usage warn Danny Baumann http://review.cyanogenmod.org/28914
Change-Id: Ie9681313bbc95ed0b6cb1e0000c5ae5b61e7b5d1
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'tests/src/com/cyanogenmod/filemanager')
12 files changed, 93 insertions, 245 deletions
diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/AbstractConsoleTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/AbstractConsoleTest.java index fa1b0908..202c07d7 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/AbstractConsoleTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/AbstractConsoleTest.java @@ -20,15 +20,12 @@ import com.cyanogenmod.filemanager.FileManagerApplication; import com.cyanogenmod.filemanager.console.Console; import com.cyanogenmod.filemanager.console.ConsoleBuilder; import com.cyanogenmod.filemanager.console.shell.ShellConsole; -import com.cyanogenmod.filemanager.util.FileHelper; /** * An abstract class that manages tests that needs a console. */ public abstract class AbstractConsoleTest extends android.test.AndroidTestCase { - private static final String INITIAL_DIR = FileHelper.ROOT_DIRECTORY; - private Console mConsole; /** @@ -46,9 +43,9 @@ public abstract class AbstractConsoleTest extends android.test.AndroidTestCase { //Setup the console if (isRootConsoleNeeded()) { FileManagerApplication.changeBackgroundConsoleToPriviligedConsole(); - this.mConsole = ConsoleBuilder.createPrivilegedConsole(getContext(), INITIAL_DIR); + this.mConsole = ConsoleBuilder.createPrivilegedConsole(getContext()); } else { - this.mConsole = ConsoleBuilder.createNonPrivilegedConsole(getContext(), INITIAL_DIR); + this.mConsole = ConsoleBuilder.createNonPrivilegedConsole(getContext()); } super.setUp(); diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommandTest.java deleted file mode 100644 index 2ef12a47..00000000 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/ChangeCurrentDirCommandTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2012 The CyanogenMod Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cyanogenmod.filemanager.commands.shell; - -import android.test.suitebuilder.annotation.SmallTest; - -import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory; -import com.cyanogenmod.filemanager.util.CommandHelper; -import com.cyanogenmod.filemanager.util.FileHelper; - -/** - * A class for testing the {@link ChangeCurrentDirCommand} command. - * - * @see ChangeCurrentDirCommand - */ -public class ChangeCurrentDirCommandTest extends AbstractConsoleTest { - - private static final String PATH_OK = FileHelper.ROOT_DIRECTORY; - private static final String PATH_ERROR = "/foo/foo121212"; //$NON-NLS-1$ - - /** - * {@inheritDoc} - */ - @Override - public boolean isRootConsoleNeeded() { - return false; - } - - /** - * Method that performs a test to change the directory. - * - * @throws Exception If test failed - */ - @SmallTest - public void testChangeDirOk() throws Exception { - boolean ret = CommandHelper.changeCurrentDir(getContext(), PATH_OK, getConsole()); - assertTrue("response==false", ret); //$NON-NLS-1$ - - //Verify that current directory is PATH_OK - String curDir = CommandHelper.getCurrentDir(getContext(), getConsole()); - assertTrue( - String.format( - "curDir!=%s", PATH_OK), curDir.compareTo(PATH_OK) == 0); //$NON-NLS-1$ - } - - /** - * Method that performs a test to change the fake directory. - * - * @throws Exception If test failed - */ - @SmallTest - public void testChangeDirFail() throws Exception { - String oldPwd = CommandHelper.getCurrentDir(getContext(), getConsole()); - try { - CommandHelper.changeCurrentDir(getContext(), PATH_ERROR, getConsole()); - assertTrue("exit code==0", false); //$NON-NLS-1$ - } catch (NoSuchFileOrDirectory error) { - //This command must failed. exit code !=0 - } - - //Verify that current directory is PATH_OK - String newPwd = CommandHelper.getCurrentDir(getContext(), getConsole()); - assertTrue( - String.format( - "curDir!=%s", oldPwd), newPwd.compareTo(oldPwd) == 0); //$NON-NLS-1$ - } - - -} diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/CompressCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/CompressCommandTest.java index 2c02732e..dc46d6a9 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/CompressCommandTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/CompressCommandTest.java @@ -138,21 +138,26 @@ public class CompressCommandTest extends AbstractConsoleTest { CompressExecutable cmd = CommandHelper.compress( getContext(), mode, dst, ARCHIVE_DATA, new AsyncResultListener() { + @Override public void onAsyncStart() { /**NON BLOCK**/ } + @Override public void onAsyncEnd(boolean cancelled) { synchronized (CompressCommandTest.this.mSync) { CompressCommandTest.this.mNormalEnd = true; CompressCommandTest.this.mSync.notify(); } } + @Override public void onAsyncExitCode(int exitCode) { /**NON BLOCK**/ } + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override public void onPartialResult(Object result) { CompressCommandTest.this.mNewPartialData = true; Log.d(TAG, (String)result); @@ -199,21 +204,26 @@ public class CompressCommandTest extends AbstractConsoleTest { cmd = CommandHelper.compress( getContext(), mode, COMPRESS_DATA_DST, new AsyncResultListener() { + @Override public void onAsyncStart() { /**NON BLOCK**/ } + @Override public void onAsyncEnd(boolean cancelled) { synchronized (CompressCommandTest.this.mSync) { CompressCommandTest.this.mNormalEnd = true; CompressCommandTest.this.mSync.notify(); } } + @Override public void onAsyncExitCode(int exitCode) { /**NON BLOCK**/ } + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override public void onPartialResult(Object result) { CompressCommandTest.this.mNewPartialData = true; Log.d(TAG, (String)result); diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommandTest.java deleted file mode 100644 index 5cd5f3ba..00000000 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/CurrentDirCommandTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2012 The CyanogenMod Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cyanogenmod.filemanager.commands.shell; - -import android.os.Environment; -import android.test.suitebuilder.annotation.SmallTest; - -import com.cyanogenmod.filemanager.util.CommandHelper; - -/** - * A class for testing the {@link CurrentDirCommand} command. - * - * @see CurrentDirCommand - */ -public class CurrentDirCommandTest extends AbstractConsoleTest { - - private static final String PATH = - Environment.getExternalStorageDirectory().getAbsolutePath(); - - /** - * {@inheritDoc} - */ - @Override - public boolean isRootConsoleNeeded() { - return false; - } - - /** - * Method that performs a test for retrieve current directory. - * - * @throws Exception If test failed - */ - @SmallTest - public void testCurrentDir() throws Exception { - CommandHelper.changeCurrentDir(getContext(), PATH, getConsole()); - String curDir = CommandHelper.getCurrentDir(getContext(), getConsole()); - assertTrue( - String.format( - "current directory!=%s; %s", PATH, curDir), //$NON-NLS-1$ - curDir.compareTo(PATH) == 0); - } - - -} diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/ExecCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/ExecCommandTest.java index 7cfd0964..a456c059 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/ExecCommandTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/ExecCommandTest.java @@ -16,8 +16,6 @@ package com.cyanogenmod.filemanager.commands.shell; -import java.io.OutputStream; - import android.os.Environment; import android.test.suitebuilder.annotation.MediumTest; @@ -26,6 +24,8 @@ import com.cyanogenmod.filemanager.commands.WriteExecutable; import com.cyanogenmod.filemanager.model.Permissions; import com.cyanogenmod.filemanager.util.CommandHelper; +import java.io.OutputStream; + /** * A class for testing exec command. * @@ -81,20 +81,25 @@ public class ExecCommandTest extends AbstractConsoleTest { // Execute the test program this.mNewPartialData = false; CommandHelper.exec(getContext(), EXEC_CMD, new AsyncResultListener() { + @Override public void onAsyncStart() { /**NON BLOCK**/ } + @Override public void onAsyncEnd(boolean cancelled) { synchronized (ExecCommandTest.this.mSync) { ExecCommandTest.this.mSync.notify(); } } + @Override public void onAsyncExitCode(int exitCode) { /**NON BLOCK**/ } + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override public void onPartialResult(Object results) { ExecCommandTest.this.mNewPartialData = true; } diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/FindCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/FindCommandTest.java index 46ce9daa..d12b69e4 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/FindCommandTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/FindCommandTest.java @@ -16,9 +16,6 @@ package com.cyanogenmod.filemanager.commands.shell; -import java.util.ArrayList; -import java.util.List; - import android.os.Environment; import android.test.suitebuilder.annotation.LargeTest; @@ -28,6 +25,10 @@ import com.cyanogenmod.filemanager.model.FileSystemObject; import com.cyanogenmod.filemanager.model.Query; import com.cyanogenmod.filemanager.util.CommandHelper; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + /** * A class for testing find command. * @@ -36,8 +37,12 @@ import com.cyanogenmod.filemanager.util.CommandHelper; public class FindCommandTest extends AbstractConsoleTest { private static final String FIND_PATH = - Environment.getDataDirectory().getAbsolutePath(); - private static final String FIND_TERM_PARTIAL = "shared"; //$NON-NLS-1$ + Environment.getRootDirectory().getAbsolutePath(); + private static final String FIND_TERM_PARTIAL = "build"; //$NON-NLS-1$ + + private static final File TEST_FILE = + new File (Environment.getRootDirectory(), + "build.prop"); //$NON-NLS-1$ /** * @hide @@ -73,21 +78,26 @@ public class FindCommandTest extends AbstractConsoleTest { final List<FileSystemObject> files = new ArrayList<FileSystemObject>(); AsyncResultExecutable cmd = CommandHelper.findFiles(getContext(), FIND_PATH, query, new AsyncResultListener() { + @Override public void onAsyncStart() { /**NON BLOCK**/ } + @Override public void onAsyncEnd(boolean cancelled) { synchronized (FindCommandTest.this.mSync) { FindCommandTest.this.mNormalEnd = true; FindCommandTest.this.mSync.notify(); } } + @Override public void onAsyncExitCode(int exitCode) { /**NON BLOCK**/ } + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override @SuppressWarnings("unchecked") public void onPartialResult(Object results) { FindCommandTest.this.mNewPartialData = true; @@ -105,6 +115,16 @@ public class FindCommandTest extends AbstractConsoleTest { assertTrue("no new partial data", this.mNewPartialData); //$NON-NLS-1$ assertNotNull("files==null", files); //$NON-NLS-1$ assertTrue("no objects returned", files.size() > 0); //$NON-NLS-1$ + boolean found = false; + int cc = files.size(); + for (int i = 0; i < cc; i++) { + FileSystemObject fso = files.get(i); + if (fso.getParent().compareTo(TEST_FILE.getParent()) == 0 && + fso.getName().compareTo(TEST_FILE.getName()) == 0) { + found = true; + } + } + assertTrue(String.format("test file %s not found", TEST_FILE), found); //$NON-NLS-1$ } } diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/FolderUsageCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/FolderUsageCommandTest.java index 6a9b0ed7..fca1b04a 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/FolderUsageCommandTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/FolderUsageCommandTest.java @@ -75,21 +75,26 @@ public class FolderUsageCommandTest extends AbstractConsoleTest { this.mUsage = null; AsyncResultExecutable cmd = CommandHelper.getFolderUsage(getContext(), PATH, new AsyncResultListener() { + @Override public void onAsyncStart() { /**NON BLOCK**/ } + @Override public void onAsyncEnd(boolean cancelled) { synchronized (FolderUsageCommandTest.this.mSync) { FolderUsageCommandTest.this.mNormalEnd = true; FolderUsageCommandTest.this.mSync.notify(); } } + @Override public void onAsyncExitCode(int exitCode) { /**NON BLOCK**/ } + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override public void onPartialResult(Object result) { FolderUsageCommandTest.this.mNewPartialData = true; try { diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/ListCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/ListCommandTest.java index 5fcc8bc1..7b3e5873 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/ListCommandTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/ListCommandTest.java @@ -16,22 +16,18 @@ package com.cyanogenmod.filemanager.commands.shell; -import java.util.List; - import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; -import com.cyanogenmod.filemanager.model.BlockDevice; -import com.cyanogenmod.filemanager.model.CharacterDevice; import com.cyanogenmod.filemanager.model.Directory; -import com.cyanogenmod.filemanager.model.DomainSocket; import com.cyanogenmod.filemanager.model.FileSystemObject; -import com.cyanogenmod.filemanager.model.NamedPipe; import com.cyanogenmod.filemanager.model.RegularFile; import com.cyanogenmod.filemanager.model.Symlink; import com.cyanogenmod.filemanager.util.CommandHelper; import com.cyanogenmod.filemanager.util.FileHelper; +import java.util.List; + /** * A class for testing list command. * @@ -90,21 +86,16 @@ public class ListCommandTest extends AbstractConsoleTest { public void testParse() throws Exception { ListCommand cmd = new ListCommand(LS_PATH, getConsole()); String in = - "drwxr-xr-x root root 2012-05-04 01:51 acct\n" + //$NON-NLS-1$ - "-rw-r--r-- root root2 229 2012-05-04 01:51 boot.txt\n" + //$NON-NLS-1$ - "lrwxrwxrwx root root 2012-05-04 01:51 d -> " //$NON-NLS-1$ - + "/sys/kernel/debug\n" + //$NON-NLS-1$ - "prw-r--r-- root root 0 2012-05-04 01:51 pipe\n" + //$NON-NLS-1$ - "srw-r--r-- root root 0 2012-05-04 01:51 socket\n" + //$NON-NLS-1$ - "brw------- root root 7, 0 2012-05-04 01:51 loop0\n" + //$NON-NLS-1$ - "crw------- root root 4, 64 2012-05-04 01:51 ttyS0\n" + //$NON-NLS-1$ - "-rwsr-sr-t root root 229 2012-05-04 01:51 permission1\n" + //$NON-NLS-1$ - "-rwSr-Sr-T root root 229 2012-05-04 01:51 permission2"; //$NON-NLS-1$ + "/acct 0 0 41ed 0 0 d 1054 3 0 0 1357390899 1357390899 1357390899 4096\n" + //$NON-NLS-1$ + "/init.cm.rc 1238 8 81e8 0 0 1 370 1 0 0 1357390899 1357390899 1357390899 4096\n" + //$NON-NLS-1$ + "/vendor 14 0 a1ff 0 0 1 1052 1 0 0 1357390899 1357390899 1357390899 4096\n" + //$NON-NLS-1$ + "/cache 4096 8 41f9 1000 2001 b307 2 5 0 0 0 1357390900 1357390900 4096\n"; //$NON-NLS-1$ + String err = ""; //$NON-NLS-1$ cmd.parse(in, err); List<FileSystemObject> files = cmd.getResult(); assertNotNull("files==null", files); //$NON-NLS-1$ - assertTrue("length!=9", files.size() == 9); //$NON-NLS-1$ + assertTrue("length!=4", files.size() == 4); //$NON-NLS-1$ assertTrue( "files(0) is not a directory", //$NON-NLS-1$ files.get(0) instanceof Directory); @@ -114,77 +105,22 @@ public class ListCommandTest extends AbstractConsoleTest { assertTrue( "files(2) is not a symlink", //$NON-NLS-1$ files.get(2) instanceof Symlink); + assertNotNull( + "files(2) linkref is null", //$NON-NLS-1$ + ((Symlink)files.get(2)).getLinkRef()); assertTrue( - "files(3) is not a named pipe", //$NON-NLS-1$ - files.get(3) instanceof NamedPipe); - assertTrue( - "files(4) is not a domain socket", //$NON-NLS-1$ - files.get(4) instanceof DomainSocket); - assertTrue( - "files(5) is not a block device", //$NON-NLS-1$ - files.get(5) instanceof BlockDevice); - assertTrue( - "files(6) is not a character device", //$NON-NLS-1$ - files.get(6) instanceof CharacterDevice); - assertTrue( - "files(0) != name", //$NON-NLS-1$ - files.get(0).getName().compareTo("acct") == 0); //$NON-NLS-1$ - assertTrue( - "files(2) != name", //$NON-NLS-1$ - files.get(2).getName().compareTo("d") == 0); //$NON-NLS-1$ - assertTrue( - "files(2) != link", //$NON-NLS-1$ - ((Symlink)files.get(2)).getLink().compareTo( - "/sys/kernel/debug") == 0); //$NON-NLS-1$ - assertTrue( - "files(1) != user", //$NON-NLS-1$ - files.get(1).getUser().getName().compareTo("root") == 0); //$NON-NLS-1$ + "files(3) != user", //$NON-NLS-1$ + files.get(3).getUser().getName().compareTo("system") == 0); //$NON-NLS-1$ assertTrue( - "files(1) != group", //$NON-NLS-1$ - files.get(1).getGroup().getName().compareTo("root2") == 0); //$NON-NLS-1$ + "files(3) != group", //$NON-NLS-1$ + files.get(3).getGroup().getName().compareTo("cache") == 0); //$NON-NLS-1$ assertTrue( "files(1) != size", //$NON-NLS-1$ - files.get(1).getSize() == 229); + files.get(1).getSize() == 1238); assertTrue( "files(1) != permissions", //$NON-NLS-1$ files.get(1).getPermissions() - .toRawString().compareTo("rw-r--r--") == 0); //$NON-NLS-1$ - assertTrue( - "files(7) != setuid", //$NON-NLS-1$ - files.get(7).getPermissions().getUser().isSetUID()); - assertTrue( - "files(7) != setgid", //$NON-NLS-1$ - files.get(7).getPermissions().getGroup().isSetGID()); - assertTrue( - "files(7) != stickybit", //$NON-NLS-1$ - files.get(7).getPermissions().getOthers().isStickybit()); - assertTrue( - "files(7) != setuid+execute", //$NON-NLS-1$ - files.get(7).getPermissions().getUser().isExecute()); - assertTrue( - "files(7) != setgid+execute", //$NON-NLS-1$ - files.get(7).getPermissions().getGroup().isExecute()); - assertTrue( - "files(7) != stickybit+execute", //$NON-NLS-1$ - files.get(7).getPermissions().getOthers().isExecute()); - assertTrue( - "files(8) != setuid", //$NON-NLS-1$ - files.get(8).getPermissions().getUser().isSetUID()); - assertTrue( - "files(8) != setgid", //$NON-NLS-1$ - files.get(8).getPermissions().getGroup().isSetGID()); - assertTrue( - "files(8) != stickybit", //$NON-NLS-1$ - files.get(8).getPermissions().getOthers().isStickybit()); - assertTrue( - "files(8) != setuid+execute", //$NON-NLS-1$ - !files.get(8).getPermissions().getUser().isExecute()); - assertTrue( - "files(8) != setgid+execute", //$NON-NLS-1$ - !files.get(8).getPermissions().getGroup().isExecute()); - assertTrue( - "files(8) != stickybit+execute", //$NON-NLS-1$ - !files.get(8).getPermissions().getOthers().isExecute()); + .toRawString().compareTo("rwxr-x---") == 0); //$NON-NLS-1$ } } diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/ReadCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/ReadCommandTest.java index b0625dbd..51cb8a5a 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/ReadCommandTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/ReadCommandTest.java @@ -68,21 +68,26 @@ public class ReadCommandTest extends AbstractConsoleTest { final StringBuffer sb = new StringBuffer(); AsyncResultExecutable cmd = CommandHelper.read(getContext(), READ_FILE, new AsyncResultListener() { + @Override public void onAsyncStart() { /**NON BLOCK**/ } + @Override public void onAsyncEnd(boolean cancelled) { synchronized (ReadCommandTest.this.mSync) { ReadCommandTest.this.mNormalEnd = true; ReadCommandTest.this.mSync.notify(); } } + @Override public void onAsyncExitCode(int exitCode) { /**NON BLOCK**/ } + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override public void onPartialResult(Object results) { ReadCommandTest.this.mNewPartialData = true; sb.append(new String((byte[])results)); diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/UncompressCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/UncompressCommandTest.java index 6fbfb3aa..59c4041c 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/UncompressCommandTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/UncompressCommandTest.java @@ -184,21 +184,26 @@ public class UncompressCommandTest extends AbstractConsoleTest { cmd = CommandHelper.uncompress( getContext(), src, null, new AsyncResultListener() { + @Override public void onAsyncStart() { /**NON BLOCK**/ } + @Override public void onAsyncEnd(boolean cancelled) { synchronized (UncompressCommandTest.this.mSync) { UncompressCommandTest.this.mNormalEnd = true; UncompressCommandTest.this.mSync.notify(); } } + @Override public void onAsyncExitCode(int exitCode) { /**NON BLOCK**/ } + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override public void onPartialResult(Object result) { UncompressCommandTest.this.mNewPartialData = true; Log.d(TAG, (String)result); diff --git a/tests/src/com/cyanogenmod/filemanager/commands/shell/WriteCommandTest.java b/tests/src/com/cyanogenmod/filemanager/commands/shell/WriteCommandTest.java index 2e14a993..ec04ab10 100644 --- a/tests/src/com/cyanogenmod/filemanager/commands/shell/WriteCommandTest.java +++ b/tests/src/com/cyanogenmod/filemanager/commands/shell/WriteCommandTest.java @@ -16,9 +16,6 @@ package com.cyanogenmod.filemanager.commands.shell; -import java.io.OutputStream; -import java.util.Random; - import android.os.Environment; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.SmallTest; @@ -27,6 +24,9 @@ import com.cyanogenmod.filemanager.commands.AsyncResultListener; import com.cyanogenmod.filemanager.commands.WriteExecutable; import com.cyanogenmod.filemanager.util.CommandHelper; +import java.io.OutputStream; +import java.util.Random; + /** * A class for testing write command. * @@ -61,12 +61,17 @@ public class WriteCommandTest extends AbstractConsoleTest { WriteExecutable cmd = CommandHelper.write(getContext(), WRITE_FILE_SMALL, new AsyncResultListener() { + @Override public void onAsyncStart() {/**NON BLOCK**/} + @Override public void onAsyncEnd(boolean cancelled) {/**NON BLOCK**/} + @Override public void onAsyncExitCode(int exitCode) {/**NON BLOCK**/} + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override public void onPartialResult(Object results) {/**NON BLOCK**/} }, getConsole()); OutputStream os = cmd.createOutputStream(); @@ -93,12 +98,17 @@ public class WriteCommandTest extends AbstractConsoleTest { WriteExecutable cmd = CommandHelper.write(getContext(), WRITE_FILE_LARGE, new AsyncResultListener() { + @Override public void onAsyncStart() {/**NON BLOCK**/} + @Override public void onAsyncEnd(boolean cancelled) {/**NON BLOCK**/} + @Override public void onAsyncExitCode(int exitCode) {/**NON BLOCK**/} + @Override public void onException(Exception cause) { fail(String.valueOf(cause)); } + @Override public void onPartialResult(Object results) {/**NON BLOCK**/} }, getConsole()); OutputStream os = cmd.createOutputStream(); diff --git a/tests/src/com/cyanogenmod/filemanager/console/ConsoleBuilderTest.java b/tests/src/com/cyanogenmod/filemanager/console/ConsoleBuilderTest.java index 7d163095..6cfe481a 100644 --- a/tests/src/com/cyanogenmod/filemanager/console/ConsoleBuilderTest.java +++ b/tests/src/com/cyanogenmod/filemanager/console/ConsoleBuilderTest.java @@ -16,7 +16,6 @@ package com.cyanogenmod.filemanager.console; -import android.os.Environment; import android.test.suitebuilder.annotation.SmallTest; @@ -27,9 +26,6 @@ import android.test.suitebuilder.annotation.SmallTest; */ public class ConsoleBuilderTest extends android.test.AndroidTestCase { - private static final String PATH = - Environment.getExternalStorageDirectory().getAbsolutePath(); - /** * {@inheritDoc} */ @@ -50,11 +46,11 @@ public class ConsoleBuilderTest extends android.test.AndroidTestCase { * Method that performs a test over creating a privileged console. * * @throws Exception If test failed - * @{link {@link ConsoleBuilder#createPrivilegedConsole(android.content.Context, String)} + * @{link {@link ConsoleBuilder#createPrivilegedConsole(android.content.Context)} */ @SmallTest public void testCreatePrivilegedConsole() throws Exception { - Console console = ConsoleBuilder.createPrivilegedConsole(getContext(), PATH); + Console console = ConsoleBuilder.createPrivilegedConsole(getContext()); try { assertNotNull("console==null", console); //$NON-NLS-1$ } finally { @@ -70,11 +66,11 @@ public class ConsoleBuilderTest extends android.test.AndroidTestCase { * Method that performs a test over creating a non privileged console. * * @throws Exception If test failed - * @{link {@link ConsoleBuilder#createNonPrivilegedConsole(android.content.Context, String)} + * @{link {@link ConsoleBuilder#createNonPrivilegedConsole(android.content.Context)} */ @SmallTest public void testCreateNonPrivilegedConsole() throws Exception { - Console console = ConsoleBuilder.createNonPrivilegedConsole(getContext(), PATH); + Console console = ConsoleBuilder.createNonPrivilegedConsole(getContext()); try { assertNotNull("console==null", console); //$NON-NLS-1$ } finally { |