| 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 static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
| 8 | 8 |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.net.Uri; | 10 import android.net.Uri; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 intent.putExtra(ShortcutHelper.EXTRA_URL, "about:blank"); | 85 intent.putExtra(ShortcutHelper.EXTRA_URL, "about:blank"); |
| 86 intent.putExtra(ShortcutHelper.EXTRA_NAME, WEBAPP_NAME); | 86 intent.putExtra(ShortcutHelper.EXTRA_NAME, WEBAPP_NAME); |
| 87 intent.putExtra(ShortcutHelper.EXTRA_SHORT_NAME, WEBAPP_SHORT_NAME); | 87 intent.putExtra(ShortcutHelper.EXTRA_SHORT_NAME, WEBAPP_SHORT_NAME); |
| 88 return intent; | 88 return intent; |
| 89 } | 89 } |
| 90 | 90 |
| 91 @Override | 91 @Override |
| 92 protected void setUp() throws Exception { | 92 protected void setUp() throws Exception { |
| 93 super.setUp(); | 93 super.setUp(); |
| 94 | 94 |
| 95 |
| 95 // Register the webapp so when the data storage is opened, the test does
n't crash. There is | 96 // Register the webapp so when the data storage is opened, the test does
n't crash. There is |
| 96 // no race condition with the retrieval as AsyncTasks are run sequential
ly on the background | 97 // no race condition with the retrieval as AsyncTasks are run sequential
ly on the background |
| 97 // thread. | 98 // thread. |
| 98 WebappRegistry.registerWebapp( | 99 WebappRegistry.warmUpSharedPrefs(""); |
| 100 WebappRegistry.getInstance().register( |
| 99 WEBAPP_ID, new WebappRegistry.FetchWebappDataStorageCallback() { | 101 WEBAPP_ID, new WebappRegistry.FetchWebappDataStorageCallback() { |
| 100 @Override | 102 @Override |
| 101 public void onWebappDataStorageRetrieved(WebappDataStorage s
torage) { | 103 public void onWebappDataStorageRetrieved(WebappDataStorage s
torage) { |
| 102 storage.updateFromShortcutIntent(createIntent()); | 104 storage.updateFromShortcutIntent(createIntent()); |
| 103 } | 105 } |
| 104 }); | 106 }); |
| 105 } | 107 } |
| 106 | 108 |
| 107 /** | 109 /** |
| 108 * Starts up the WebappActivity and sets up the test observer. | 110 * Starts up the WebappActivity and sets up the test observer. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 fail(); | 217 fail(); |
| 216 } | 218 } |
| 217 | 219 |
| 218 ViewGroup splashScreen = getActivity().getSplashScreenForTests(); | 220 ViewGroup splashScreen = getActivity().getSplashScreenForTests(); |
| 219 if (splashScreen == null) { | 221 if (splashScreen == null) { |
| 220 fail("No splash screen available."); | 222 fail("No splash screen available."); |
| 221 } | 223 } |
| 222 return splashScreen; | 224 return splashScreen; |
| 223 } | 225 } |
| 224 } | 226 } |
| OLD | NEW |