| 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 /** | 848 /** |
| 849 * Tests that launching a regular Chrome tab after warmup() gives the right
layout. | 849 * Tests that launching a regular Chrome tab after warmup() gives the right
layout. |
| 850 * | 850 * |
| 851 * About the restrictions and switches: No FRE and no document mode to get a | 851 * About the restrictions and switches: No FRE and no document mode to get a |
| 852 * ChromeTabbedActivity, and no tablets to have the tab switcher button. | 852 * ChromeTabbedActivity, and no tablets to have the tab switcher button. |
| 853 * | 853 * |
| 854 * Non-regression test for crbug.com/547121. | 854 * Non-regression test for crbug.com/547121. |
| 855 */ | 855 */ |
| 856 @SmallTest | 856 @SmallTest |
| 857 @Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE) | 857 @Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE) |
| 858 @CommandLineFlags.Add({ | 858 @CommandLineFlags.Add(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE) |
| 859 ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, ChromeSwitches.DISABLE_
DOCUMENT_MODE}) | |
| 860 public void testWarmupAndLaunchRegularChrome() { | 859 public void testWarmupAndLaunchRegularChrome() { |
| 861 warmUpAndWait(); | 860 warmUpAndWait(); |
| 862 Intent intent = | 861 Intent intent = |
| 863 new Intent(getInstrumentation().getTargetContext(), ChromeLaunch
erActivity.class); | 862 new Intent(getInstrumentation().getTargetContext(), ChromeLaunch
erActivity.class); |
| 864 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 863 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 865 | 864 |
| 866 Instrumentation.ActivityMonitor monitor = | 865 Instrumentation.ActivityMonitor monitor = |
| 867 getInstrumentation().addMonitor(ChromeTabbedActivity.class.getNa
me(), null, false); | 866 getInstrumentation().addMonitor(ChromeTabbedActivity.class.getNa
me(), null, false); |
| 868 Activity activity = getInstrumentation().startActivitySync(intent); | 867 Activity activity = getInstrumentation().startActivitySync(intent); |
| 869 assertNotNull("Main activity did not start", activity); | 868 assertNotNull("Main activity did not start", activity); |
| 870 ChromeTabbedActivity tabbedActivity = | 869 ChromeTabbedActivity tabbedActivity = |
| 871 (ChromeTabbedActivity) monitor.waitForActivityWithTimeout( | 870 (ChromeTabbedActivity) monitor.waitForActivityWithTimeout( |
| 872 ACTIVITY_START_TIMEOUT_MS); | 871 ACTIVITY_START_TIMEOUT_MS); |
| 873 assertNotNull("ChromeTabbedActivity did not start", tabbedActivity); | 872 assertNotNull("ChromeTabbedActivity did not start", tabbedActivity); |
| 874 assertNotNull("Should have a tab switcher button.", | 873 assertNotNull("Should have a tab switcher button.", |
| 875 tabbedActivity.findViewById(R.id.tab_switcher_button)); | 874 tabbedActivity.findViewById(R.id.tab_switcher_button)); |
| 876 } | 875 } |
| 877 | 876 |
| 878 /** | 877 /** |
| 879 * Tests that launching a Custom Tab after warmup() gives the right layout. | 878 * Tests that launching a Custom Tab after warmup() gives the right layout. |
| 880 * | 879 * |
| 881 * Non-regression test for crbug.com/547121. | 880 * Non-regression test for crbug.com/547121. |
| 882 */ | 881 */ |
| 883 @SmallTest | 882 @SmallTest |
| 884 @Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE) | 883 @Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE) |
| 885 @CommandLineFlags.Add({ | 884 @CommandLineFlags.Add(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE) |
| 886 ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, ChromeSwitches.DISABLE_
DOCUMENT_MODE}) | |
| 887 public void testWarmupAndLaunchRightToolbarLayout() { | 885 public void testWarmupAndLaunchRightToolbarLayout() { |
| 888 warmUpAndWait(); | 886 warmUpAndWait(); |
| 889 startActivityCompletely(createMinimalCustomTabIntent()); | 887 startActivityCompletely(createMinimalCustomTabIntent()); |
| 890 assertNull("Should not have a tab switcher button.", | 888 assertNull("Should not have a tab switcher button.", |
| 891 mActivity.findViewById(R.id.tab_switcher_button)); | 889 mActivity.findViewById(R.id.tab_switcher_button)); |
| 892 } | 890 } |
| 893 | 891 |
| 894 /** | 892 /** |
| 895 * Tests the following scenario: | 893 * Tests the following scenario: |
| 896 * - warmup() + mayLaunchUrl("http://example.com/page.html#first-fragment") | 894 * - warmup() + mayLaunchUrl("http://example.com/page.html#first-fragment") |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; | 1371 if (jsonText.equalsIgnoreCase("null")) jsonText = ""; |
| 1374 value = jsonText; | 1372 value = jsonText; |
| 1375 } catch (InterruptedException | TimeoutException e) { | 1373 } catch (InterruptedException | TimeoutException e) { |
| 1376 e.printStackTrace(); | 1374 e.printStackTrace(); |
| 1377 return false; | 1375 return false; |
| 1378 } | 1376 } |
| 1379 return TextUtils.equals(mExpected, value); | 1377 return TextUtils.equals(mExpected, value); |
| 1380 } | 1378 } |
| 1381 } | 1379 } |
| 1382 } | 1380 } |
| OLD | NEW |