1 /* ownCloud Android client application
2 * Copyright (C) 2012-2013 ownCloud Inc.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package com.owncloud.android.oc_framework_test_project.test;
20 import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
21 import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
22 import com.owncloud.android.oc_framework_test_project.TestActivity;
24 import android.test.ActivityInstrumentationTestCase2;
27 * Class to test Delete a File Operation
32 public class DeleteFileTest extends ActivityInstrumentationTestCase2<TestActivity> {
34 /* Folder data to delete. */
35 private final String mFolderPath = "/folderToDelete";
38 private final String mFilePath = "fileToDelete.png";
40 private TestActivity mActivity;
42 public DeleteFileTest() {
43 super(TestActivity.class);
48 protected void setUp() throws Exception {
50 setActivityInitialTouchMode(false);
51 mActivity = getActivity();
57 public void testRemoveFolder() {
59 RemoteOperationResult result = mActivity.removeFile(mFolderPath);
60 assertTrue(result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND);
66 public void testRemoveFile() {
68 RemoteOperationResult result = mActivity.removeFile(mFilePath);
69 assertTrue(result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND);
73 * Restore initial conditions
75 public void testRestoreInitialConditions() {
76 RemoteOperationResult result = mActivity.createFolder(mFolderPath, true);
77 assertTrue(result.isSuccess());