2086257d97f2285c4c325b0c2a50e9720e574dcc
[pub/Android/ownCloud.git] /
1 /* ownCloud Android client application
2 * Copyright (C) 2012-2013 ownCloud Inc.
3 *
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.
7 *
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.
12 *
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/>.
15 *
16 */
17
18 package com.owncloud.android.oc_framework_test_project.test;
19
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;
23
24 import android.test.ActivityInstrumentationTestCase2;
25
26 /**
27 * Class to test Delete a File Operation
28 * @author masensio
29 *
30 */
31
32 public class DeleteFileTest extends ActivityInstrumentationTestCase2<TestActivity> {
33
34 /* Folder data to delete. */
35 private final String mFolderPath = "/folderToDelete";
36
37 /* File to delete. */
38 private final String mFilePath = "fileToDelete.png";
39
40 private TestActivity mActivity;
41
42 public DeleteFileTest() {
43 super(TestActivity.class);
44
45 }
46
47 @Override
48 protected void setUp() throws Exception {
49 super.setUp();
50 setActivityInitialTouchMode(false);
51 mActivity = getActivity();
52 }
53
54 /**
55 * Test Remove Folder
56 */
57 public void testRemoveFolder() {
58
59 RemoteOperationResult result = mActivity.removeFile(mFolderPath);
60 assertTrue(result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND);
61 }
62
63 /**
64 * Test Remove File
65 */
66 public void testRemoveFile() {
67
68 RemoteOperationResult result = mActivity.removeFile(mFilePath);
69 assertTrue(result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND);
70 }
71
72 /**
73 * Restore initial conditions
74 */
75 public void testRestoreInitialConditions() {
76 RemoteOperationResult result = mActivity.createFolder(mFolderPath, true);
77 assertTrue(result.isSuccess());
78
79 }
80 }