aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Chabot <brettchabot@android.com>2010-08-23 21:37:48 -0700
committerAndroid Code Review <code-review@android.com>2010-08-23 21:37:48 -0700
commitd08f295027a952bb1ef863b0d9169ae15d4dde88 (patch)
tree0185d54fff5eea58d58a424f5b21a752ef7b5199
parent75c387873705004edb5c9d1d1b10a2d550c3d92c (diff)
parente4ba03d5d76dce987b1e49c6cfbbdefd09e961e7 (diff)
downloadsdk-d08f295027a952bb1ef863b0d9169ae15d4dde88.zip
sdk-d08f295027a952bb1ef863b0d9169ae15d4dde88.tar.gz
sdk-d08f295027a952bb1ef863b0d9169ae15d4dde88.tar.bz2
Merge "Allow adt-tests to access package-private elements."
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/annotations/VisibleForTesting.java17
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SimpleAttribute.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF14
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AndroidTestPlugin.java69
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java5
5 files changed, 16 insertions, 92 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/annotations/VisibleForTesting.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/annotations/VisibleForTesting.java
index 379371d..b495692 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/annotations/VisibleForTesting.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/annotations/VisibleForTesting.java
@@ -23,17 +23,16 @@ import java.lang.annotation.RetentionPolicy;
* Denotes that the class, method or field has its visibility relaxed so
* that unit tests can access it.
* <p/>
- * When running the AdtTest Plugin in a headless Eclipse configuration,
- * AdtTest <em>cannot</em> access package-private members of the ADT plugin
- * so we need to relax the visibility of certain classes or methods.
- * <p/>
* The <code>visibility</code> argument can be used to specific what the original
- * visibility should have been if it had not been made public for testing.
+ * visibility should have been if it had not been made public or package-private for testing.
* The default is to consider the element private.
*/
-@Retention(RetentionPolicy.CLASS)
+@Retention(RetentionPolicy.SOURCE)
public @interface VisibleForTesting {
- /** Intended visibility if the element had not been made public for testing. */
+ /**
+ * Intended visibility if the element had not been made public or package-private for
+ * testing.
+ */
enum Visibility {
/** The element should be considered protected. */
PROTECTED,
@@ -44,8 +43,8 @@ public @interface VisibleForTesting {
}
/**
- * Intended visibility if the element had not been made public for testing.
- * If not specified, one should assume the element originally intented to be private.
+ * Intended visibility if the element had not been made public or package-private for testing.
+ * If not specified, one should assume the element originally intended to be private.
*/
Visibility visibility() default Visibility.PRIVATE;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SimpleAttribute.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SimpleAttribute.java
index 0ebe7ac..739cd47 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SimpleAttribute.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SimpleAttribute.java
@@ -87,8 +87,7 @@ public class SimpleAttribute implements IDragAttribute, IAttribute {
private static final Pattern REGEXP =
Pattern.compile("[^@]*@([^:]+):([^=]*)=([^\n]*)\n*"); //$NON-NLS-1$
- @VisibleForTesting(visibility=Visibility.PACKAGE)
- public static SimpleAttribute parseString(String value) {
+ static SimpleAttribute parseString(String value) {
Matcher m = REGEXP.matcher(value);
if (m.matches()) {
return new SimpleAttribute(m.group(2), m.group(1), m.group(3));
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
index 9bd7db8..00686bc 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
@@ -3,18 +3,10 @@ Bundle-ManifestVersion: 2
Bundle-Name: Android Plugin Tests
Bundle-SymbolicName: com.android.ide.eclipse.tests
Bundle-Version: 0.9.8.qualifier
-Bundle-Activator: com.android.ide.eclipse.tests.AndroidTestPlugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- com.android.ide.eclipse.adt,
- org.junit,
- org.eclipse.jdt.core,
- org.eclipse.jdt.launching,
- org.eclipse.ui.views,
- com.android.ide.eclipse.ddms
-Bundle-ActivationPolicy: lazy
Bundle-Vendor: The Android Open Source Project
+Fragment-Host: com.android.ide.eclipse.adt;bundle-version="0.9.8"
+Require-Bundle: org.junit
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: kxml2-2.3.0.jar,
.,
layoutlib.jar,
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AndroidTestPlugin.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AndroidTestPlugin.java
deleted file mode 100644
index 45a6fbc..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AndroidTestPlugin.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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.ide.eclipse.tests;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class AndroidTestPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "com.android.ide.eclipse.adt.tests";
-
- // The shared instance
- private static AndroidTestPlugin sPlugin;
-
- /**
- * The constructor
- */
- public AndroidTestPlugin() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- sPlugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- sPlugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static AndroidTestPlugin getDefault() {
- return sPlugin;
- }
-
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java
index bdbe7f0..2d74f82 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java
@@ -16,6 +16,8 @@
package com.android.ide.eclipse.tests;
+import com.android.ide.eclipse.adt.AdtPlugin;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -37,7 +39,8 @@ public class UnitTests {
TestSuite suite = new TestSuite();
UnitTestCollector collector = new UnitTestCollector();
- collector.addTestCases(suite, AndroidTestPlugin.getDefault(), TEST_PACKAGE);
+ // since this plugin is a fragment which runs insde adt, gather tests from AdtPlugin
+ collector.addTestCases(suite, AdtPlugin.getDefault(), TEST_PACKAGE);
return suite;
}