OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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.chrome.browser.webapps; | 5 package org.chromium.chrome.browser.webapps; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 import android.net.Uri; | 8 import android.net.Uri; |
9 import android.view.ViewGroup; | 9 import android.view.ViewGroup; |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 import java.util.concurrent.TimeoutException; | 21 import java.util.concurrent.TimeoutException; |
22 | 22 |
23 /** | 23 /** |
24 * The base class of the WebappActivity tests. It provides the common methods to
access the activity | 24 * The base class of the WebappActivity tests. It provides the common methods to
access the activity |
25 * UI. This particular test base only instantiates WebappActivity0. | 25 * UI. This particular test base only instantiates WebappActivity0. |
26 */ | 26 */ |
27 public abstract class WebappActivityTestBase extends ChromeActivityTestCaseBase<
WebappActivity0> { | 27 public abstract class WebappActivityTestBase extends ChromeActivityTestCaseBase<
WebappActivity0> { |
28 static final String WEBAPP_ID = "webapp_id"; | 28 static final String WEBAPP_ID = "webapp_id"; |
29 static final String WEBAPP_NAME = "webapp name"; | 29 static final String WEBAPP_NAME = "webapp name"; |
30 static final String WEBAPP_SHORT_NAME = "webapp short name"; | 30 static final String WEBAPP_SHORT_NAME = "webapp short name"; |
31 static final String WEBAPP_URL = "https://www.google.com"; | |
32 | 31 |
33 // Empty 192x192 image generated with: | 32 // Empty 192x192 image generated with: |
34 // ShortcutHelper.encodeBitmapAsString(Bitmap.createBitmap(192, 192, Bitmap.
Config.ARGB_4444)); | 33 // ShortcutHelper.encodeBitmapAsString(Bitmap.createBitmap(192, 192, Bitmap.
Config.ARGB_4444)); |
35 protected static final String TEST_ICON = | 34 protected static final String TEST_ICON = |
36 "iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAABHNCSVQICAgIfAhkiAA
AAKZJREFU" | 35 "iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAABHNCSVQICAgIfAhkiAA
AAKZJREFU" |
37 + "eJztwTEBAAAAwqD1T20JT6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA" | 36 + "eJztwTEBAAAAwqD1T20JT6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA" |
38 + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA" | 37 + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA" |
39 + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4GQ
N4AAe3mX6IA" | 38 + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4GQ
N4AAe3mX6IA" |
40 + "AAAASUVORK5CYII="; | 39 + "AAAASUVORK5CYII="; |
41 | 40 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return intent; | 84 return intent; |
86 } | 85 } |
87 | 86 |
88 @Override | 87 @Override |
89 protected void setUp() throws Exception { | 88 protected void setUp() throws Exception { |
90 super.setUp(); | 89 super.setUp(); |
91 | 90 |
92 // Register the webapp so when the data storage is opened, the test does
n't crash. There is | 91 // Register the webapp so when the data storage is opened, the test does
n't crash. There is |
93 // no race condition with the retrival as AsyncTasks are run sequentiall
y on the background | 92 // no race condition with the retrival as AsyncTasks are run sequentiall
y on the background |
94 // thread. | 93 // thread. |
95 WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), | 94 WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), W
EBAPP_ID) |
96 WEBAPP_ID, WEBAPP_URL); | 95 .updateFromShortcutIntent(createIntent()); |
97 } | 96 } |
98 | 97 |
99 /** | 98 /** |
100 * Starts up the WebappActivity and sets up the test observer. | 99 * Starts up the WebappActivity and sets up the test observer. |
101 */ | 100 */ |
102 protected final void startWebappActivity() throws Exception { | 101 protected final void startWebappActivity() throws Exception { |
103 startWebappActivity(createIntent()); | 102 startWebappActivity(createIntent()); |
104 } | 103 } |
105 | 104 |
106 /** | 105 /** |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 fail(); | 206 fail(); |
208 } | 207 } |
209 | 208 |
210 ViewGroup splashScreen = getActivity().getSplashScreenForTests(); | 209 ViewGroup splashScreen = getActivity().getSplashScreenForTests(); |
211 if (splashScreen == null) { | 210 if (splashScreen == null) { |
212 fail("No splash screen available."); | 211 fail("No splash screen available."); |
213 } | 212 } |
214 return splashScreen; | 213 return splashScreen; |
215 } | 214 } |
216 } | 215 } |
OLD | NEW |