OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.document; |
| 6 |
| 7 import android.content.Context; |
| 8 import android.content.Intent; |
| 9 import android.net.Uri; |
| 10 |
| 11 import org.chromium.base.ApplicationState; |
| 12 import org.chromium.base.ApplicationStatus; |
| 13 import org.chromium.chrome.browser.ChromeActivity; |
| 14 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 15 import org.chromium.content.browser.test.util.Criteria; |
| 16 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 17 |
| 18 /** |
| 19 * Tests for launching Chrome. |
| 20 */ |
| 21 public class LauncherActivityTest extends ChromeActivityTestCaseBase<ChromeActiv
ity> { |
| 22 |
| 23 private Context mContext; |
| 24 |
| 25 public LauncherActivityTest() { |
| 26 super(ChromeActivity.class); |
| 27 } |
| 28 |
| 29 @Override |
| 30 public void setUp() throws Exception { |
| 31 super.setUp(); |
| 32 mContext = getInstrumentation().getTargetContext(); |
| 33 } |
| 34 |
| 35 public void testLaunchWithUrlNoScheme() throws Exception { |
| 36 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("www.google.com
")); |
| 37 intent.setClassName(mContext.getPackageName(), ChromeLauncherActivity.cl
ass.getName()); |
| 38 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 39 mContext.startActivity(intent); |
| 40 |
| 41 // Check that Chrome launched successfully |
| 42 assertTrue(CriteriaHelper.pollForCriteria(new Criteria() { |
| 43 @Override |
| 44 public boolean isSatisfied() { |
| 45 int state = ApplicationStatus.getStateForApplication(); |
| 46 return state == ApplicationState.HAS_RUNNING_ACTIVITIES; |
| 47 } |
| 48 })); |
| 49 } |
| 50 |
| 51 @Override |
| 52 public void startMainActivity() throws InterruptedException { |
| 53 } |
| 54 |
| 55 } |
OLD | NEW |