1 /* ownCloud Android Library is available under MIT license
2 * Copyright (C) 2014 ownCloud (http://www.owncloud.org/)
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 package com.owncloud.android.oc_framework_test_project.test;
27 import com.owncloud.android.oc_framework.operations.RemoteOperationResult;
28 import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;
29 import com.owncloud.android.oc_framework_test_project.TestActivity;
31 import android.test.ActivityInstrumentationTestCase2;
34 * Class to test Delete a File Operation
39 public class DeleteFileTest extends ActivityInstrumentationTestCase2<TestActivity> {
41 /* Folder data to delete. */
42 private final String mFolderPath = "/folderToDelete";
45 private final String mFilePath = "fileToDelete.png";
47 private TestActivity mActivity;
49 public DeleteFileTest() {
50 super(TestActivity.class);
55 protected void setUp() throws Exception {
57 setActivityInitialTouchMode(false);
58 mActivity = getActivity();
64 public void testRemoveFolder() {
66 RemoteOperationResult result = mActivity.removeFile(mFolderPath);
67 assertTrue(result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND);
73 public void testRemoveFile() {
75 RemoteOperationResult result = mActivity.removeFile(mFilePath);
76 assertTrue(result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND);
80 * Restore initial conditions
82 public void testRestoreInitialConditions() {
83 RemoteOperationResult result = mActivity.createFolder(mFolderPath, true);
84 assertTrue(result.isSuccess());