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.net; | 5 package org.chromium.net; |
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; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 /** | 61 /** |
62 * Starts the CronetTest activity appending the provided command line | 62 * Starts the CronetTest activity appending the provided command line |
63 * arguments and loads the given URL. The URL can be null. | 63 * arguments and loads the given URL. The URL can be null. |
64 */ | 64 */ |
65 protected CronetTestActivity launchCronetTestAppWithUrlAndCommandLineArgs( | 65 protected CronetTestActivity launchCronetTestAppWithUrlAndCommandLineArgs( |
66 String url, String[] commandLineArgs) { | 66 String url, String[] commandLineArgs) { |
67 Intent intent = new Intent(Intent.ACTION_MAIN); | 67 Intent intent = new Intent(Intent.ACTION_MAIN); |
68 intent.addCategory(Intent.CATEGORY_LAUNCHER); | 68 intent.addCategory(Intent.CATEGORY_LAUNCHER); |
69 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 69 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
70 if (url != null) | 70 if (url != null) intent.setData(Uri.parse(url)); |
71 intent.setData(Uri.parse(url)); | |
72 intent.setComponent(new ComponentName( | 71 intent.setComponent(new ComponentName( |
73 getInstrumentation().getTargetContext(), | 72 getInstrumentation().getTargetContext(), |
74 CronetTestActivity.class)); | 73 CronetTestActivity.class)); |
75 if (commandLineArgs != null) { | 74 if (commandLineArgs != null) { |
76 intent.putExtra(CronetTestActivity.COMMAND_LINE_ARGS_KEY, | 75 intent.putExtra(CronetTestActivity.COMMAND_LINE_ARGS_KEY, |
77 commandLineArgs); | 76 commandLineArgs); |
78 } | 77 } |
79 setActivityIntent(intent); | 78 setActivityIntent(intent); |
80 // Make sure the activity was created as expected. | 79 // Make sure the activity was created as expected. |
81 assertNotNull(getActivity()); | 80 assertNotNull(getActivity()); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 @Retention(RetentionPolicy.RUNTIME) | 203 @Retention(RetentionPolicy.RUNTIME) |
205 public @interface CompareDefaultWithCronet { | 204 public @interface CompareDefaultWithCronet { |
206 } | 205 } |
207 | 206 |
208 @Target(ElementType.METHOD) | 207 @Target(ElementType.METHOD) |
209 @Retention(RetentionPolicy.RUNTIME) | 208 @Retention(RetentionPolicy.RUNTIME) |
210 public @interface OnlyRunCronetHttpURLConnection { | 209 public @interface OnlyRunCronetHttpURLConnection { |
211 } | 210 } |
212 | 211 |
213 } | 212 } |
OLD | NEW |