| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.content.Intent; | 7 import android.content.Intent; |
| 8 import android.os.Parcel; | 8 import android.os.Parcel; |
| 9 import android.test.FlakyTest; | 9 import android.test.FlakyTest; |
| 10 import android.test.suitebuilder.annotation.MediumTest; | 10 import android.test.suitebuilder.annotation.MediumTest; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 | 156 |
| 157 private void addShortcutToURL(String url, final String title) throws Interru
ptedException { | 157 private void addShortcutToURL(String url, final String title) throws Interru
ptedException { |
| 158 loadUrlWithSanitization(url); | 158 loadUrlWithSanitization(url); |
| 159 assertTrue(waitForActiveShellToBeDoneLoading()); | 159 assertTrue(waitForActiveShellToBeDoneLoading()); |
| 160 | 160 |
| 161 // Add the shortcut. | 161 // Add the shortcut. |
| 162 getInstrumentation().runOnMainSync(new Runnable() { | 162 getInstrumentation().runOnMainSync(new Runnable() { |
| 163 @Override | 163 @Override |
| 164 public void run() { | 164 public void run() { |
| 165 ShortcutHelper.addShortcut(mActivity.getActiveTab(), title); | 165 ShortcutHelper.addShortcut(mActivity.getApplicationContext(), |
| 166 mActivity.getActiveTab(), title); |
| 166 } | 167 } |
| 167 }); | 168 }); |
| 168 | 169 |
| 169 // Make sure that the shortcut was added. | 170 // Make sure that the shortcut was added. |
| 170 assertTrue(CriteriaHelper.pollForCriteria(new Criteria() { | 171 assertTrue(CriteriaHelper.pollForCriteria(new Criteria() { |
| 171 @Override | 172 @Override |
| 172 public boolean isSatisfied() { | 173 public boolean isSatisfied() { |
| 173 return mTestObserver.firedIntent != null; | 174 return mTestObserver.firedIntent != null; |
| 174 } | 175 } |
| 175 })); | 176 })); |
| 176 } | 177 } |
| 177 } | 178 } |
| OLD | NEW |