OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.appmenu; | 5 package org.chromium.chrome.browser.appmenu; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.pm.ActivityInfo; | 8 import android.content.pm.ActivityInfo; |
9 import android.support.test.filters.SmallTest; | 9 import android.support.test.filters.SmallTest; |
10 import android.view.KeyEvent; | 10 import android.view.KeyEvent; |
(...skipping 15 matching lines...) Expand all Loading... |
26 import org.chromium.content.browser.test.util.Criteria; | 26 import org.chromium.content.browser.test.util.Criteria; |
27 import org.chromium.content.browser.test.util.CriteriaHelper; | 27 import org.chromium.content.browser.test.util.CriteriaHelper; |
28 | 28 |
29 import java.util.concurrent.Callable; | 29 import java.util.concurrent.Callable; |
30 | 30 |
31 /** | 31 /** |
32 * Tests AppMenu popup | 32 * Tests AppMenu popup |
33 */ | 33 */ |
34 @RetryOnFailure | 34 @RetryOnFailure |
35 public class AppMenuTest extends ChromeActivityTestCaseBase<ChromeActivity> { | 35 public class AppMenuTest extends ChromeActivityTestCaseBase<ChromeActivity> { |
36 private static final String TEST_URL = UrlUtils.encodeHtmlDataUri("<html>poi
t.</html>"); | 36 private static final String TEST_URL = UrlUtils.encodeHtmlDataUri("<html>foo
</html>"); |
37 | 37 |
38 private AppMenu mAppMenu; | 38 private AppMenu mAppMenu; |
39 private AppMenuHandler mAppMenuHandler; | 39 private AppMenuHandler mAppMenuHandler; |
40 | 40 |
41 /** | 41 /** |
42 * AppMenuHandler that will be used to intercept item selections for testing
. | 42 * AppMenuHandler that will be used to intercept item selections for testing
. |
43 */ | 43 */ |
44 @SuppressFBWarnings("URF_UNREAD_FIELD") | 44 @SuppressFBWarnings("URF_UNREAD_FIELD") |
45 public static class AppMenuHandlerForTest extends AppMenuHandler { | 45 public static class AppMenuHandlerForTest extends AppMenuHandler { |
46 int mLastSelectedItemId = -1; | 46 int mLastSelectedItemId = -1; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 ListView listView = popup.getListView(); | 285 ListView listView = popup.getListView(); |
286 return listView.getSelectedItemPosition(); | 286 return listView.getSelectedItemPosition(); |
287 } | 287 } |
288 | 288 |
289 private int getCount() { | 289 private int getCount() { |
290 ListPopupWindow popup = mAppMenu.getPopup(); | 290 ListPopupWindow popup = mAppMenu.getPopup(); |
291 if (popup == null || popup.getListView() == null) return 0; | 291 if (popup == null || popup.getListView() == null) return 0; |
292 return popup.getListView().getCount(); | 292 return popup.getListView().getCount(); |
293 } | 293 } |
294 } | 294 } |
OLD | NEW |