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.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.test.suitebuilder.annotation.MediumTest; | 7 import android.test.suitebuilder.annotation.MediumTest; |
8 | 8 |
9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 /** | 56 /** |
57 * Call |lockOrientation| and wait for an orientation change. | 57 * Call |lockOrientation| and wait for an orientation change. |
58 */ | 58 */ |
59 private boolean lockOrientationAndWait(final int orientations) throws Interr
uptedException { | 59 private boolean lockOrientationAndWait(final int orientations) throws Interr
uptedException { |
60 OrientationChangeObserverCriteria criteria = | 60 OrientationChangeObserverCriteria criteria = |
61 new OrientationChangeObserverCriteria(mObserver); | 61 new OrientationChangeObserverCriteria(mObserver); |
62 | 62 |
63 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 63 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
64 @Override | 64 @Override |
65 public void run() { | 65 public void run() { |
66 ScreenOrientationProvider.lockOrientation((byte)orientations); | 66 ScreenOrientationProvider.lockOrientation((byte) orientations); |
67 } | 67 } |
68 }); | 68 }); |
69 getInstrumentation().waitForIdleSync(); | 69 getInstrumentation().waitForIdleSync(); |
70 | 70 |
71 return CriteriaHelper.pollForCriteria(criteria); | 71 return CriteriaHelper.pollForCriteria(criteria); |
72 } | 72 } |
73 | 73 |
74 @Override | 74 @Override |
75 public void setUp() throws Exception { | 75 public void setUp() throws Exception { |
76 super.setUp(); | 76 super.setUp(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 // There is no point in testing the case where we try to lock to | 170 // There is no point in testing the case where we try to lock to |
171 // PORTRAIT_PRIMARY | PORTRAIT_SECONDARY | LANDSCAPE_PRIMARY | LANDSCAPE_SEC
ONDARY | 171 // PORTRAIT_PRIMARY | PORTRAIT_SECONDARY | LANDSCAPE_PRIMARY | LANDSCAPE_SEC
ONDARY |
172 // because with the device being likely flat during the test, locking to tha
t | 172 // because with the device being likely flat during the test, locking to tha
t |
173 // will be a no-op. | 173 // will be a no-op. |
174 | 174 |
175 // We can't test unlock because the device is likely flat during the test | 175 // We can't test unlock because the device is likely flat during the test |
176 // and in that situation unlocking is a no-op. | 176 // and in that situation unlocking is a no-op. |
177 } | 177 } |
OLD | NEW |