Chromium Code Reviews| Index: content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java |
| diff --git a/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java b/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c28260650c224bdec607aa4c3564e3360bc4a24c |
| --- /dev/null |
| +++ b/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java |
| @@ -0,0 +1,35 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.content_shell; |
| + |
| +import android.app.Activity; |
| +import android.content.ComponentName; |
| +import android.content.Intent; |
| +import android.net.Uri; |
| +import android.test.ActivityInstrumentationTestCase2; |
| + |
| +/** |
| + * Base test class for all ContentShell based tests. |
| + */ |
| +public class ContentShellTestBase<T extends Activity> extends ActivityInstrumentationTestCase2<T> { |
|
Ted C
2012/07/11 22:28:28
why do we need to templatize this base activity?
cjhopman
2012/07/12 18:13:08
Done. I don't know why this was templatized, but I
|
| + |
| + public ContentShellTestBase(Class<T> activityClass) { |
| + super(activityClass); |
| + } |
| + |
| + /** |
| + * Starts the ContentShell activity and loads the given URL. |
| + */ |
| + protected Activity launchContentShellWithUrl(String url) { |
|
Ted C
2012/07/11 22:28:28
Might as well just return ContentShellActivity sin
cjhopman
2012/07/12 18:13:08
Done.
|
| + Intent intent = new Intent(Intent.ACTION_MAIN); |
| + intent.addCategory(Intent.CATEGORY_LAUNCHER); |
| + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| + intent.setData(Uri.parse(url)); |
| + intent.setComponent(new ComponentName(getInstrumentation().getTargetContext(), |
| + org.chromium.content_shell.ContentShellActivity.class)); |
| + return getInstrumentation().startActivitySync(intent); |
| + } |
| + |
| +} |