| 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.customtabs; | 5 package org.chromium.chrome.browser.customtabs; |
| 6 | 6 |
| 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E
ND_DEVICE; | 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E
ND_DEVICE; |
| 8 | 8 |
| 9 import android.app.Activity; | 9 import android.app.Activity; |
| 10 import android.app.Application; | 10 import android.app.Application; |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 assertNotNull(menu.findItem(R.id.reload_menu_id)); | 381 assertNotNull(menu.findItem(R.id.reload_menu_id)); |
| 382 assertNotNull(menu.findItem(R.id.open_in_browser_id)); | 382 assertNotNull(menu.findItem(R.id.open_in_browser_id)); |
| 383 assertFalse(menu.findItem(R.id.share_row_menu_id).isVisible()); | 383 assertFalse(menu.findItem(R.id.share_row_menu_id).isVisible()); |
| 384 assertFalse(menu.findItem(R.id.share_row_menu_id).isEnabled()); | 384 assertFalse(menu.findItem(R.id.share_row_menu_id).isEnabled()); |
| 385 assertNotNull(menu.findItem(R.id.find_in_page_id)); | 385 assertNotNull(menu.findItem(R.id.find_in_page_id)); |
| 386 assertNotNull(menu.findItem(R.id.add_to_homescreen_id)); | 386 assertNotNull(menu.findItem(R.id.add_to_homescreen_id)); |
| 387 assertNotNull(menu.findItem(R.id.request_desktop_site_id)); | 387 assertNotNull(menu.findItem(R.id.request_desktop_site_id)); |
| 388 } | 388 } |
| 389 | 389 |
| 390 /** | 390 /** |
| 391 * Test the entries in app menu for media viewer. |
| 392 */ |
| 393 @SmallTest |
| 394 @RetryOnFailure |
| 395 public void testAppMenuForMediaViewer() throws InterruptedException { |
| 396 Intent intent = createMinimalCustomTabIntent(); |
| 397 intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_MEDIA_VIEWER, true)
; |
| 398 IntentHandler.addTrustedIntentExtras(intent); |
| 399 startCustomTabActivityWithIntent(intent); |
| 400 |
| 401 openAppMenuAndAssertMenuShown(); |
| 402 Menu menu = getActivity().getAppMenuHandler().getAppMenu().getMenu(); |
| 403 final int expectedMenuSize = 0; |
| 404 final int actualMenuSize = getActualMenuSize(menu); |
| 405 |
| 406 assertNotNull("App menu is not initialized: ", menu); |
| 407 assertEquals(expectedMenuSize, actualMenuSize); |
| 408 assertFalse(menu.findItem(R.id.find_in_page_id).isVisible()); |
| 409 assertFalse(menu.findItem(R.id.add_to_homescreen_id).isVisible()); |
| 410 assertFalse(menu.findItem(R.id.request_desktop_site_id).isVisible()); |
| 411 assertFalse(menu.findItem(R.id.open_in_browser_id).isVisible()); |
| 412 } |
| 413 |
| 414 /** |
| 391 * Tests if the default share item can be shown in the app menu. | 415 * Tests if the default share item can be shown in the app menu. |
| 392 */ | 416 */ |
| 393 @SmallTest | 417 @SmallTest |
| 394 @RetryOnFailure | 418 @RetryOnFailure |
| 395 public void testShareMenuItem() throws InterruptedException { | 419 public void testShareMenuItem() throws InterruptedException { |
| 396 Intent intent = createMinimalCustomTabIntent(); | 420 Intent intent = createMinimalCustomTabIntent(); |
| 397 intent.putExtra(CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM, true); | 421 intent.putExtra(CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM, true); |
| 398 startCustomTabActivityWithIntent(intent); | 422 startCustomTabActivityWithIntent(intent); |
| 399 | 423 |
| 400 openAppMenuAndAssertMenuShown(); | 424 openAppMenuAndAssertMenuShown(); |
| (...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; | 1882 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; |
| 1859 value = jsonText; | 1883 value = jsonText; |
| 1860 } catch (InterruptedException | TimeoutException e) { | 1884 } catch (InterruptedException | TimeoutException e) { |
| 1861 e.printStackTrace(); | 1885 e.printStackTrace(); |
| 1862 return false; | 1886 return false; |
| 1863 } | 1887 } |
| 1864 return TextUtils.equals(mExpected, value); | 1888 return TextUtils.equals(mExpected, value); |
| 1865 } | 1889 } |
| 1866 } | 1890 } |
| 1867 } | 1891 } |
| OLD | NEW |