| 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"; |
| 31 | 32 |
| 32 // Empty 192x192 image generated with: | 33 // Empty 192x192 image generated with: |
| 33 // ShortcutHelper.encodeBitmapAsString(Bitmap.createBitmap(192, 192, Bitmap.
Config.ARGB_4444)); | 34 // ShortcutHelper.encodeBitmapAsString(Bitmap.createBitmap(192, 192, Bitmap.
Config.ARGB_4444)); |
| 34 protected static final String TEST_ICON = | 35 protected static final String TEST_ICON = |
| 35 "iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAABHNCSVQICAgIfAhkiAA
AAKZJREFU" | 36 "iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAABHNCSVQICAgIfAhkiAA
AAKZJREFU" |
| 36 + "eJztwTEBAAAAwqD1T20JT6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA" | 37 + "eJztwTEBAAAAwqD1T20JT6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA" |
| 37 + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA" | 38 + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA" |
| 38 + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4GQ
N4AAe3mX6IA" | 39 + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4GQ
N4AAe3mX6IA" |
| 39 + "AAAASUVORK5CYII="; | 40 + "AAAASUVORK5CYII="; |
| 40 | 41 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return intent; | 85 return intent; |
| 85 } | 86 } |
| 86 | 87 |
| 87 @Override | 88 @Override |
| 88 protected void setUp() throws Exception { | 89 protected void setUp() throws Exception { |
| 89 super.setUp(); | 90 super.setUp(); |
| 90 | 91 |
| 91 // Register the webapp so when the data storage is opened, the test does
n't crash. There is | 92 // Register the webapp so when the data storage is opened, the test does
n't crash. There is |
| 92 // no race condition with the retrival as AsyncTasks are run sequentiall
y on the background | 93 // no race condition with the retrival as AsyncTasks are run sequentiall
y on the background |
| 93 // thread. | 94 // thread. |
| 94 WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), W
EBAPP_ID); | 95 WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), |
| 96 WEBAPP_ID, WEBAPP_URL); |
| 95 } | 97 } |
| 96 | 98 |
| 97 /** | 99 /** |
| 98 * Starts up the WebappActivity and sets up the test observer. | 100 * Starts up the WebappActivity and sets up the test observer. |
| 99 */ | 101 */ |
| 100 protected final void startWebappActivity() throws Exception { | 102 protected final void startWebappActivity() throws Exception { |
| 101 startWebappActivity(createIntent()); | 103 startWebappActivity(createIntent()); |
| 102 } | 104 } |
| 103 | 105 |
| 104 /** | 106 /** |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 fail(); | 207 fail(); |
| 206 } | 208 } |
| 207 | 209 |
| 208 ViewGroup splashScreen = getActivity().getSplashScreenForTests(); | 210 ViewGroup splashScreen = getActivity().getSplashScreenForTests(); |
| 209 if (splashScreen == null) { | 211 if (splashScreen == null) { |
| 210 fail("No splash screen available."); | 212 fail("No splash screen available."); |
| 211 } | 213 } |
| 212 return splashScreen; | 214 return splashScreen; |
| 213 } | 215 } |
| 214 } | 216 } |
| OLD | NEW |