| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.cronet_sample_apk; | 5 package org.chromium.cronet_sample_apk; |
| 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.os.ConditionVariable; | 10 import android.os.ConditionVariable; |
| 11 import android.test.ActivityInstrumentationTestCase2; | 11 import android.test.ActivityInstrumentationTestCase2; |
| 12 import android.test.FlakyTest; | |
| 13 import android.text.Editable; | 12 import android.text.Editable; |
| 14 import android.text.TextWatcher; | 13 import android.text.TextWatcher; |
| 15 import android.widget.TextView; | 14 import android.widget.TextView; |
| 16 | 15 |
| 16 import org.chromium.base.test.util.FlakyTest; |
| 17 import org.chromium.net.test.EmbeddedTestServer; | 17 import org.chromium.net.test.EmbeddedTestServer; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Base test class for all CronetSample based tests. | 20 * Base test class for all CronetSample based tests. |
| 21 */ | 21 */ |
| 22 public class CronetSampleTest extends | 22 public class CronetSampleTest extends |
| 23 ActivityInstrumentationTestCase2<CronetSampleActivity> { | 23 ActivityInstrumentationTestCase2<CronetSampleActivity> { |
| 24 private EmbeddedTestServer mTestServer; | 24 private EmbeddedTestServer mTestServer; |
| 25 private String mUrl; | 25 private String mUrl; |
| 26 | 26 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 @Override | 39 @Override |
| 40 protected void tearDown() throws Exception { | 40 protected void tearDown() throws Exception { |
| 41 mTestServer.stopAndDestroyServer(); | 41 mTestServer.stopAndDestroyServer(); |
| 42 super.tearDown(); | 42 super.tearDown(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 /* | 45 /* |
| 46 @SmallTest | 46 @SmallTest |
| 47 @Feature({"Cronet"}) | 47 @Feature({"Cronet"}) |
| 48 https://crbug.com/592444 | |
| 49 */ | 48 */ |
| 50 @FlakyTest | 49 @FlakyTest(message = "https://crbug.com/592444") |
| 51 public void testLoadUrl() throws Exception { | 50 public void testLoadUrl() throws Exception { |
| 52 CronetSampleActivity activity = launchCronetSampleWithUrl(mUrl); | 51 CronetSampleActivity activity = launchCronetSampleWithUrl(mUrl); |
| 53 | 52 |
| 54 // Make sure the activity was created as expected. | 53 // Make sure the activity was created as expected. |
| 55 assertNotNull(activity); | 54 assertNotNull(activity); |
| 56 | 55 |
| 57 // Verify successful fetch. | 56 // Verify successful fetch. |
| 58 final TextView textView = (TextView) activity.findViewById(R.id.resultVi
ew); | 57 final TextView textView = (TextView) activity.findViewById(R.id.resultVi
ew); |
| 59 final ConditionVariable done = new ConditionVariable(); | 58 final ConditionVariable done = new ConditionVariable(); |
| 60 final TextWatcher textWatcher = new TextWatcher() { | 59 final TextWatcher textWatcher = new TextWatcher() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 85 intent.addCategory(Intent.CATEGORY_LAUNCHER); | 84 intent.addCategory(Intent.CATEGORY_LAUNCHER); |
| 86 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 85 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 87 intent.setData(Uri.parse(url)); | 86 intent.setData(Uri.parse(url)); |
| 88 intent.setComponent(new ComponentName( | 87 intent.setComponent(new ComponentName( |
| 89 getInstrumentation().getTargetContext(), | 88 getInstrumentation().getTargetContext(), |
| 90 CronetSampleActivity.class)); | 89 CronetSampleActivity.class)); |
| 91 setActivityIntent(intent); | 90 setActivityIntent(intent); |
| 92 return getActivity(); | 91 return getActivity(); |
| 93 } | 92 } |
| 94 } | 93 } |
| OLD | NEW |