| 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.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 @Override | 153 @Override |
| 154 public void startMainActivity() throws InterruptedException { | 154 public void startMainActivity() throws InterruptedException { |
| 155 startMainActivityOnBlankPage(); | 155 startMainActivityOnBlankPage(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 @Override | 158 @Override |
| 159 public void setUp() throws Exception { | 159 public void setUp() throws Exception { |
| 160 super.setUp(); | 160 super.setUp(); |
| 161 ChromeWebApkHost.initForTesting(false); | 161 ChromeWebApkHost.initForTesting(false); |
| 162 mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation
().getContext()); | 162 mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation
().getContext()); |
| 163 // Register handler for "slow?10000" URL. | |
| 164 mTestServer.addDefaultHandlers(mTestServer.getURL("/chrome/test/data")); | |
| 165 mShortcutHelperDelegate = new TestShortcutHelperDelegate(); | 163 mShortcutHelperDelegate = new TestShortcutHelperDelegate(); |
| 166 ShortcutHelper.setDelegateForTests(mShortcutHelperDelegate); | 164 ShortcutHelper.setDelegateForTests(mShortcutHelperDelegate); |
| 167 mActivity = getActivity(); | 165 mActivity = getActivity(); |
| 168 mTab = mActivity.getActivityTab(); | 166 mTab = mActivity.getActivityTab(); |
| 169 } | 167 } |
| 170 | 168 |
| 171 @SmallTest | 169 @SmallTest |
| 172 @Feature("{Webapp}") | 170 @Feature("{Webapp}") |
| 173 public void testAddWebappShortcuts() throws Exception { | 171 public void testAddWebappShortcuts() throws Exception { |
| 174 // Add a webapp shortcut and make sure the intent's parameters make sens
e. | 172 // Add a webapp shortcut and make sure the intent's parameters make sens
e. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 public Integer call() { | 337 public Integer call() { |
| 340 return getActivity().getTabModelSelector().getModel(false).getCo
unt(); | 338 return getActivity().getTabModelSelector().getModel(false).getCo
unt(); |
| 341 } | 339 } |
| 342 })); | 340 })); |
| 343 | 341 |
| 344 TabModel tabModel = getActivity().getTabModelSelector().getModel(false); | 342 TabModel tabModel = getActivity().getTabModelSelector().getModel(false); |
| 345 assertEquals(0, tabModel.indexOf(mTab)); | 343 assertEquals(0, tabModel.indexOf(mTab)); |
| 346 return getActivity().getTabModelSelector().getModel(false).getTabAt(1); | 344 return getActivity().getTabModelSelector().getModel(false).getTabAt(1); |
| 347 } | 345 } |
| 348 } | 346 } |
| OLD | NEW |