Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content_shell; | 5 package org.chromium.content_shell; |
| 6 | 6 |
| 7 import android.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.net.Uri; | 9 import android.net.Uri; |
| 10 import android.test.ActivityInstrumentationTestCase2; | 10 import android.test.ActivityInstrumentationTestCase2; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Base test class for all ContentShell based tests. | 13 * Base test class for all ContentShell based tests. |
| 14 */ | 14 */ |
| 15 public class ContentShellTestBase extends ActivityInstrumentationTestCase2<Conte ntShellActivity> { | 15 public class ContentShellTestBase extends ActivityInstrumentationTestCase2<Conte ntShellActivity> { |
| 16 | 16 |
| 17 public ContentShellTestBase() { | 17 public ContentShellTestBase() { |
| 18 super(ContentShellActivity.class); | 18 super(ContentShellActivity.class); |
| 19 } | 19 } |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Starts the ContentShell activity and loads the given URL. | 22 * Starts the ContentShell activity and loads the given URL. |
| 23 */ | 23 */ |
| 24 protected ContentShellActivity launchContentShellWithUrl(String url) { | 24 protected ContentShellActivity launchContentShellWithUrl(String url) { |
| 25 Intent intent = new Intent(Intent.ACTION_MAIN); | 25 Intent intent = new Intent(Intent.ACTION_MAIN); |
| 26 intent.addCategory(Intent.CATEGORY_LAUNCHER); | 26 intent.addCategory(Intent.CATEGORY_LAUNCHER); |
| 27 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 27 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 28 intent.setData(Uri.parse(url)); | 28 intent.setData(Uri.parse(url)); |
| 29 intent.setComponent(new ComponentName(getInstrumentation().getTargetCont ext(), | 29 intent.setComponent(new ComponentName(getInstrumentation().getTargetCont ext(), |
| 30 ContentShellActivity.class)); | 30 ContentShellActivity.class)); |
|
Ted C
2012/09/20 17:07:04
same...+2 indent
David Trainor- moved to gerrit
2012/09/20 21:49:50
Eagle eye...
.'''''.
' .
__' 0
| |
| 31 return (ContentShellActivity) getInstrumentation().startActivitySync(int ent); | 31 setActivityIntent(intent); |
| 32 return getActivity(); | |
| 32 } | 33 } |
| 33 } | 34 } |
| OLD | NEW |