Move TestResources class to the outside of MtpDocumentProviderTest.

TestResources class will be used in MtpDatabaseTest.

BUG=25162822

Change-Id: I4f51b517532bbc111e95e7ebd96787a2e6f0f87a
This commit is contained in:
Daichi Hirono
2015-10-27 16:29:18 +09:00
parent 0c4a76959a
commit b999b0cb0f
2 changed files with 31 additions and 14 deletions

View File

@@ -16,9 +16,6 @@
package com.android.mtp;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.database.Cursor;
import android.mtp.MtpConstants;
import android.mtp.MtpObjectInfo;
@@ -26,7 +23,6 @@ import android.net.Uri;
import android.provider.DocumentsContract.Root;
import android.provider.DocumentsContract;
import android.test.AndroidTestCase;
import android.test.mock.MockResources;
import android.test.suitebuilder.annotation.SmallTest;
import java.io.FileNotFoundException;
@@ -39,16 +35,7 @@ public class MtpDocumentsProviderTest extends AndroidTestCase {
private TestContentResolver mResolver;
private MtpDocumentsProvider mProvider;
private TestMtpManager mMtpManager;
private final MockResources mResources = new MockResources() {
@Override
public String getString(int id) throws NotFoundException {
switch (id) {
case R.string.root_name:
return "%1$s %2$s";
}
throw new NotFoundException();
}
};
private final TestResources mResources = new TestResources();
@Override
public void setUp() throws IOException {

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2015 The Android Open Source 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.android.mtp;
import android.test.mock.MockResources;
class TestResources extends MockResources {
@Override
public String getString(int id) throws NotFoundException {
switch (id) {
case R.string.root_name:
return "%1$s %2$s";
}
throw new NotFoundException();
}
}