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.firstrun; | 5 package org.chromium.chrome.browser.firstrun; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.os.Build; | 8 import android.os.Build; |
9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
10 import android.view.KeyEvent; | 10 import android.view.KeyEvent; |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 /** | 27 /** |
28 * Exiting the first run experience should close all tabs, | 28 * Exiting the first run experience should close all tabs, |
29 * finalize the tab closures and close Chrome. | 29 * finalize the tab closures and close Chrome. |
30 */ | 30 */ |
31 @SmallTest | 31 @SmallTest |
32 @Feature({"FirstRunExperience"}) | 32 @Feature({"FirstRunExperience"}) |
33 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) | 33 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) |
34 @RetryOnFailure | 34 @RetryOnFailure |
35 public void testExitFirstRunExperience() throws InterruptedException { | 35 public void testExitFirstRunExperience() throws InterruptedException { |
36 if (FirstRunStatus.getFirstRunFlowComplete()) { | 36 if (FirstRunStatus.getFirstRunFlowComplete(getActivity())) { |
37 return; | 37 return; |
38 } | 38 } |
39 | 39 |
40 sendKeys(KeyEvent.KEYCODE_BACK); | 40 sendKeys(KeyEvent.KEYCODE_BACK); |
41 | 41 |
42 CriteriaHelper.pollInstrumentationThread(new Criteria("Expected no tabs
to be present") { | 42 CriteriaHelper.pollInstrumentationThread(new Criteria("Expected no tabs
to be present") { |
43 @Override | 43 @Override |
44 public boolean isSatisfied() { | 44 public boolean isSatisfied() { |
45 return 0 == getActivity().getCurrentTabModel().getCount(); | 45 return 0 == getActivity().getCurrentTabModel().getCount(); |
46 } | 46 } |
47 }); | 47 }); |
48 TabList fullModel = getActivity().getCurrentTabModel().getComprehensiveM
odel(); | 48 TabList fullModel = getActivity().getCurrentTabModel().getComprehensiveM
odel(); |
49 assertEquals("Expected no tabs to be present in the comprehensive model"
, | 49 assertEquals("Expected no tabs to be present in the comprehensive model"
, |
50 0, fullModel.getCount()); | 50 0, fullModel.getCount()); |
51 CriteriaHelper.pollInstrumentationThread(new Criteria("Activity was not
closed.") { | 51 CriteriaHelper.pollInstrumentationThread(new Criteria("Activity was not
closed.") { |
52 @Override | 52 @Override |
53 public boolean isSatisfied() { | 53 public boolean isSatisfied() { |
54 return getActivity().isFinishing() || getActivity().isDestroyed(
); | 54 return getActivity().isFinishing() || getActivity().isDestroyed(
); |
55 } | 55 } |
56 }); | 56 }); |
57 } | 57 } |
58 | 58 |
59 @Override | 59 @Override |
60 public void startMainActivity() throws InterruptedException { | 60 public void startMainActivity() throws InterruptedException { |
61 startMainActivityFromLauncher(); | 61 startMainActivityFromLauncher(); |
62 } | 62 } |
63 | 63 |
64 } | 64 } |
OLD | NEW |