summaryrefslogtreecommitdiffstats
path: root/services/tests
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2011-05-23 13:37:44 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2011-05-31 12:04:18 -0700
commitcc4053e031371456fe54d51bbad1db721db4ae38 (patch)
tree9f5954a422efc283efac0762906e822dbf89377e /services/tests
parentda188fbe4b4d7b91e1440afe5a1279d0fd7a91eb (diff)
downloadframeworks_base-cc4053e031371456fe54d51bbad1db721db4ae38.zip
frameworks_base-cc4053e031371456fe54d51bbad1db721db4ae38.tar.gz
frameworks_base-cc4053e031371456fe54d51bbad1db721db4ae38.tar.bz2
Accessibility serviceconfiguration via meta-data
Note: This is a part of two CL change and contains the system changes without updates to the settings. 1. Added a mechanism for configuring an accessibility service via XML file specified in a meta-data tag (similar to IMEs). 2. Added property for specifying a settings activity for an accessibility service. 3. Refactored the APIs in AccessibilityManager to return lists of AccessiblityServiceInfo instead ServiceInfo since the former describes an AccessibilityService in particular (similar to IMEs). Change-Id: Ie8781bb7e0cdb329e583b6702a612a507367ad7b
Diffstat (limited to 'services/tests')
-rw-r--r--services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java3
-rw-r--r--services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java15
2 files changed, 11 insertions, 7 deletions
diff --git a/services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java
index 2bc6825..302a2d6 100644
--- a/services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java
@@ -150,7 +150,8 @@ public class AccessibilityManagerServiceTest extends AndroidTestCase {
String secondMockServiceClassName = MySecondMockAccessibilityService.class.getName();
// look for the two mock services
- for (ServiceInfo serviceInfo : mManagerService.getAccessibilityServiceList()) {
+ for (AccessibilityServiceInfo info : mManagerService.getInstalledAccessibilityServiceList()) {
+ ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
if (packageName.equals(serviceInfo.packageName)) {
if (firstMockServiceClassName.equals(serviceInfo.name)) {
firstMockServiceInstalled = true;
diff --git a/services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java b/services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java
index 38fed22..1463d30 100644
--- a/services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java
@@ -25,6 +25,7 @@ import static org.easymock.EasyMock.verify;
import org.easymock.IArgumentMatcher;
+import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.pm.ServiceInfo;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -62,20 +63,22 @@ public class AccessibilityManagerTest extends AndroidTestCase {
@MediumTest
public void testGetAccessibilityServiceList() throws Exception {
// create a list of installed accessibility services the mock service returns
- List<ServiceInfo> expectedServices = new ArrayList<ServiceInfo>();
- ServiceInfo serviceInfo = new ServiceInfo();
- serviceInfo.name = "TestServiceInfoName";
- expectedServices.add(serviceInfo);
+ List<AccessibilityServiceInfo> expectedServices = new ArrayList<AccessibilityServiceInfo>();
+ AccessibilityServiceInfo accessibilityServiceInfo = new AccessibilityServiceInfo();
+ accessibilityServiceInfo.packageNames = new String[] { "foo.bar" };
+ expectedServices.add(accessibilityServiceInfo);
// configure the mock service behavior
IAccessibilityManager mockServiceInterface = mMockServiceInterface;
expect(mockServiceInterface.addClient(anyIAccessibilityManagerClient())).andReturn(true);
- expect(mockServiceInterface.getAccessibilityServiceList()).andReturn(expectedServices);
+ expect(mockServiceInterface.getInstalledAccessibilityServiceList()).andReturn(
+ expectedServices);
replay(mockServiceInterface);
// invoke the method under test
AccessibilityManager manager = new AccessibilityManager(mContext, mockServiceInterface);
- List<ServiceInfo> receivedServices = manager.getAccessibilityServiceList();
+ List<AccessibilityServiceInfo> receivedServices =
+ manager.getInstalledAccessibilityServiceList();
// check expected result (list equals() compares it contents as well)
assertEquals("All expected services must be returned", receivedServices, expectedServices);