Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java

Issue 2857583005: Convert Vr tests to JUnit4 (Closed)
Patch Set: Add VrTestRule Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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.vr_shell; 5 package org.chromium.chrome.browser.vr_shell;
6 6
7 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_SHORT_MS ; 7 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_SHORT_MS ;
8 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_V IEWER_DAYDREAM; 8 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_V IEWER_DAYDREAM;
9 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_V IEWER_NON_DAYDREAM; 9 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_V IEWER_NON_DAYDREAM;
10 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_W EBVR_SUPPORTED; 10 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_W EBVR_SUPPORTED;
11 11
12 import android.os.Build; 12 import android.os.Build;
13 import android.support.test.filters.LargeTest; 13 import android.support.test.filters.LargeTest;
14 import android.support.test.filters.MediumTest; 14 import android.support.test.filters.MediumTest;
15 import android.support.test.filters.SmallTest; 15 import android.support.test.filters.SmallTest;
16 import android.widget.TextView; 16 import android.widget.TextView;
17 17
18 import org.junit.Assert;
19 import org.junit.Rule;
20 import org.junit.Test;
21 import org.junit.runner.RunWith;
22
18 import org.chromium.base.test.util.CommandLineFlags; 23 import org.chromium.base.test.util.CommandLineFlags;
19 import org.chromium.base.test.util.DisableIf; 24 import org.chromium.base.test.util.DisableIf;
20 import org.chromium.base.test.util.Restriction; 25 import org.chromium.base.test.util.Restriction;
21 import org.chromium.chrome.R; 26 import org.chromium.chrome.R;
27 import org.chromium.chrome.browser.ChromeSwitches;
28 import org.chromium.chrome.test.ChromeActivityTestRule;
29 import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
22 30
23 import java.util.concurrent.CountDownLatch; 31 import java.util.concurrent.CountDownLatch;
24 import java.util.concurrent.TimeUnit; 32 import java.util.concurrent.TimeUnit;
25 33
26 /** 34 /**
27 * End-to-end tests for WebVR using the WebVR test framework from VrTestBase. 35 * End-to-end tests for WebVR using the WebVR test framework from VrTestBase.
28 */ 36 */
29 @CommandLineFlags.Add("enable-webvr") 37 @RunWith(ChromeJUnit4ClassRunner.class)
38 @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
39 ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG, "enable-webvr"})
30 @Restriction(RESTRICTION_TYPE_WEBVR_SUPPORTED) 40 @Restriction(RESTRICTION_TYPE_WEBVR_SUPPORTED)
31 public class WebVrTest extends VrTestBase { 41 public class WebVrTest {
32 private static final String TAG = "WebVrTest"; 42 @Rule
43 public VrTestRule mVrTestRule = new VrTestRule();
33 44
34 /** 45 /**
35 * Tests that a successful requestPresent call actually enters VR 46 * Tests that a successful requestPresent call actually enters VR
36 */ 47 */
48 @Test
37 @SmallTest 49 @SmallTest
38 public void testRequestPresentEntersVr() throws InterruptedException { 50 public void testRequestPresentEntersVr() throws InterruptedException {
39 String testName = "test_requestPresent_enters_vr"; 51 String testName = "test_requestPresent_enters_vr";
40 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 52 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
41 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); 53 Assert.assertTrue(
42 enterVrTapAndWait(mWebContents); 54 "VRDisplay found", mVrTestRule.vrDisplayFound(mVrTestRule.getWeb Contents()));
43 assertTrue("VrShellDelegate is in VR", VrShellDelegate.isInVr()); 55 mVrTestRule.enterVrTapAndWait(mVrTestRule.getWebContents());
44 endTest(mWebContents); 56 Assert.assertTrue("VrShellDelegate is in VR", VrShellDelegate.isInVr());
57 mVrTestRule.endTest(mVrTestRule.getWebContents());
45 } 58 }
46 59
47 /** 60 /**
48 * Tests that scanning the Daydream View NFC tag on supported devices fires the 61 * Tests that scanning the Daydream View NFC tag on supported devices fires the
49 * vrdisplayactivate event. 62 * vrdisplayactivate event.
50 */ 63 */
64 @Test
51 @SmallTest 65 @SmallTest
52 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) 66 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM)
53 public void testNfcFiresVrdisplayactivate() throws InterruptedException { 67 public void testNfcFiresVrdisplayactivate() throws InterruptedException {
54 String testName = "test_nfc_fires_vrdisplayactivate"; 68 String testName = "test_nfc_fires_vrdisplayactivate";
55 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 69 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
56 simNfcScanAndWait(mWebContents); 70 mVrTestRule.simNfcScanAndWait(mVrTestRule.getWebContents());
57 endTest(mWebContents); 71 mVrTestRule.endTest(mVrTestRule.getWebContents());
58 } 72 }
59 73
60 /** 74 /**
61 * Tests that screen touches are not registered when the viewer is a Daydrea m View. 75 * Tests that screen touches are not registered when the viewer is a Daydrea m View.
62 */ 76 */
77 @Test
63 @LargeTest 78 @LargeTest
64 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) 79 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM)
65 public void testScreenTapsNotRegisteredOnDaydream() throws InterruptedExcept ion { 80 public void testScreenTapsNotRegisteredOnDaydream() throws InterruptedExcept ion {
66 String testName = "test_screen_taps_not_registered_on_daydream"; 81 String testName = "test_screen_taps_not_registered_on_daydream";
67 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 82 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
68 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); 83 Assert.assertTrue(
69 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents); 84 "VRDisplay found", mVrTestRule.vrDisplayFound(mVrTestRule.getWeb Contents()));
70 enterVrTapAndWait(mWebContents); 85 mVrTestRule.executeStepAndWait("stepVerifyNoInitialTaps()", mVrTestRule. getWebContents());
86 mVrTestRule.enterVrTapAndWait(mVrTestRule.getWebContents());
71 // Wait on VrShellImpl to say that its parent consumed the touch event 87 // Wait on VrShellImpl to say that its parent consumed the touch event
72 // Set to 2 because there's an ACTION_DOWN followed by ACTION_UP 88 // Set to 2 because there's an ACTION_DOWN followed by ACTION_UP
73 final CountDownLatch touchRegisteredLatch = new CountDownLatch(2); 89 final CountDownLatch touchRegisteredLatch = new CountDownLatch(2);
74 ((VrShellImpl) VrShellDelegate.getVrShellForTesting()) 90 ((VrShellImpl) VrShellDelegate.getVrShellForTesting())
75 .setOnDispatchTouchEventForTesting(new OnDispatchTouchEventCallb ack() { 91 .setOnDispatchTouchEventForTesting(new OnDispatchTouchEventCallb ack() {
76 @Override 92 @Override
77 public void onDispatchTouchEvent( 93 public void onDispatchTouchEvent(
78 boolean parentConsumed, boolean cardboardTriggered) { 94 boolean parentConsumed, boolean cardboardTriggered) {
79 if (!parentConsumed) fail("Parent did not consume event" ); 95 if (!parentConsumed) Assert.fail("Parent did not consume event");
80 if (cardboardTriggered) fail("Cardboard event triggered" ); 96 if (cardboardTriggered) Assert.fail("Cardboard event tri ggered");
81 touchRegisteredLatch.countDown(); 97 touchRegisteredLatch.countDown();
82 } 98 }
83 }); 99 });
84 enterVrTap(); 100 mVrTestRule.enterVrTap();
85 assertTrue("VrShellImpl dispatched touches", 101 Assert.assertTrue("VrShellImpl dispatched touches",
86 touchRegisteredLatch.await(POLL_TIMEOUT_SHORT_MS, TimeUnit.MILLI SECONDS)); 102 touchRegisteredLatch.await(POLL_TIMEOUT_SHORT_MS, TimeUnit.MILLI SECONDS));
87 executeStepAndWait("stepVerifyNoAdditionalTaps()", mWebContents); 103 mVrTestRule.executeStepAndWait(
88 endTest(mWebContents); 104 "stepVerifyNoAdditionalTaps()", mVrTestRule.getWebContents());
105 mVrTestRule.endTest(mVrTestRule.getWebContents());
89 } 106 }
90 107
91 /** 108 /**
92 * Tests that Daydream controller clicks are registered as screen taps when the viewer is a 109 * Tests that Daydream controller clicks are registered as screen taps when the viewer is a
93 * Daydream View. 110 * Daydream View.
94 */ 111 */
112 @Test
95 @LargeTest 113 @LargeTest
96 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) 114 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM)
97 public void testControllerClicksRegisteredAsTapsOnDaydream() throws Interrup tedException { 115 public void testControllerClicksRegisteredAsTapsOnDaydream() throws Interrup tedException {
98 EmulatedVrController controller = new EmulatedVrController(getActivity() ); 116 EmulatedVrController controller = new EmulatedVrController(mVrTestRule.g etActivity());
99 String testName = "test_screen_taps_registered"; 117 String testName = "test_screen_taps_registered";
100 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 118 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
101 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); 119 Assert.assertTrue(
102 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents); 120 "VRDisplay found", mVrTestRule.vrDisplayFound(mVrTestRule.getWeb Contents()));
121 mVrTestRule.executeStepAndWait("stepVerifyNoInitialTaps()", mVrTestRule. getWebContents());
103 // Tap and wait to enter VR 122 // Tap and wait to enter VR
104 enterVrTapAndWait(mWebContents); 123 mVrTestRule.enterVrTapAndWait(mVrTestRule.getWebContents());
105 // Send a controller click and wait for JavaScript to receive it 124 // Send a controller click and wait for JavaScript to receive it
106 controller.pressReleaseTouchpadButton(); 125 controller.pressReleaseTouchpadButton();
107 waitOnJavaScriptStep(mWebContents); 126 mVrTestRule.waitOnJavaScriptStep(mVrTestRule.getWebContents());
108 endTest(mWebContents); 127 mVrTestRule.endTest(mVrTestRule.getWebContents());
109 } 128 }
110 129
111 /** 130 /**
112 * Tests that screen touches are still registered when the viewer is Cardboa rd. 131 * Tests that screen touches are still registered when the viewer is Cardboa rd.
113 */ 132 */
133 @Test
114 @MediumTest 134 @MediumTest
115 @Restriction(RESTRICTION_TYPE_VIEWER_NON_DAYDREAM) 135 @Restriction(RESTRICTION_TYPE_VIEWER_NON_DAYDREAM)
116 @DisableIf.Build(message = "Flaky on L crbug.com/713781", 136 @DisableIf.Build(message = "Flaky on L crbug.com/713781",
117 sdk_is_greater_than = Build.VERSION_CODES.KITKAT, 137 sdk_is_greater_than = Build.VERSION_CODES.KITKAT,
118 sdk_is_less_than = Build.VERSION_CODES.M) 138 sdk_is_less_than = Build.VERSION_CODES.M)
119 public void testScreenTapsRegisteredOnCardboard() throws InterruptedExceptio n { 139 public void testScreenTapsRegisteredOnCardboard() throws InterruptedExceptio n {
120 String testName = "test_screen_taps_registered"; 140 String testName = "test_screen_taps_registered";
121 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 141 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
122 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); 142 Assert.assertTrue(
123 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents); 143 "VRDisplay found", mVrTestRule.vrDisplayFound(mVrTestRule.getWeb Contents()));
144 mVrTestRule.executeStepAndWait("stepVerifyNoInitialTaps()", mVrTestRule. getWebContents());
124 // Tap and wait to enter VR 145 // Tap and wait to enter VR
125 enterVrTapAndWait(mWebContents); 146 mVrTestRule.enterVrTapAndWait(mVrTestRule.getWebContents());
126 // Tap and wait for JavaScript to receive it 147 // Tap and wait for JavaScript to receive it
127 enterVrTapAndWait(mWebContents); 148 mVrTestRule.enterVrTapAndWait(mVrTestRule.getWebContents());
128 endTest(mWebContents); 149 mVrTestRule.endTest(mVrTestRule.getWebContents());
129 } 150 }
130 151
131 /** 152 /**
132 * Tests that non-focused tabs cannot get pose information. 153 * Tests that non-focused tabs cannot get pose information.
133 */ 154 */
155 @Test
134 @SmallTest 156 @SmallTest
135 public void testPoseDataUnfocusedTab() throws InterruptedException { 157 public void testPoseDataUnfocusedTab() throws InterruptedException {
136 String testName = "test_pose_data_unfocused_tab"; 158 String testName = "test_pose_data_unfocused_tab";
137 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 159 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
138 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); 160 Assert.assertTrue(
139 executeStepAndWait("stepCheckFrameDataWhileFocusedTab()", mWebContents); 161 "VRDisplay found", mVrTestRule.vrDisplayFound(mVrTestRule.getWeb Contents()));
162 mVrTestRule.executeStepAndWait(
163 "stepCheckFrameDataWhileFocusedTab()", mVrTestRule.getWebContent s());
140 164
141 loadUrlInNewTab("about:blank"); 165 mVrTestRule.loadUrlInNewTab("about:blank");
142 166
143 executeStepAndWait("stepCheckFrameDataWhileNonFocusedTab()", mWebContent s); 167 mVrTestRule.executeStepAndWait(
144 endTest(mWebContents); 168 "stepCheckFrameDataWhileNonFocusedTab()", mVrTestRule.getWebCont ents());
169 mVrTestRule.endTest(mVrTestRule.getWebContents());
145 } 170 }
146 171
147 /** 172 /**
148 * Helper function to run the tests checking for the upgrade/install InfoBar being present since 173 * Helper function to run the tests checking for the upgrade/install InfoBar being present since
149 * all that differs is the value returned by VrCoreVersionChecker and a coup le asserts. 174 * all that differs is the value returned by VrCoreVersionChecker and a coup le asserts.
150 * 175 *
151 * @param checkerReturnValue The value to have the VrCoreVersionChecker retu rn 176 * @param checkerReturnValue The value to have the VrCoreVersionChecker retu rn
152 */ 177 */
153 private void infoBarTestHelper(int checkerReturnValue) throws InterruptedExc eption { 178 private void infoBarTestHelper(int checkerReturnValue) throws InterruptedExc eption {
154 MockVrCoreVersionCheckerImpl mockChecker = new MockVrCoreVersionCheckerI mpl(); 179 MockVrCoreVersionCheckerImpl mockChecker = new MockVrCoreVersionCheckerI mpl();
155 mockChecker.setMockReturnValue(checkerReturnValue); 180 mockChecker.setMockReturnValue(checkerReturnValue);
156 VrUtils.getVrShellDelegateInstance().overrideVrCoreVersionCheckerForTest ing(mockChecker); 181 VrUtils.getVrShellDelegateInstance().overrideVrCoreVersionCheckerForTest ing(mockChecker);
157 String testName = "generic_webvr_page"; 182 String testName = "generic_webvr_page";
158 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 183 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
159 String displayFound = "VRDisplay Found"; 184 String displayFound = "VRDisplay Found";
160 String barPresent = "InfoBar present"; 185 String barPresent = "InfoBar present";
161 if (checkerReturnValue == VrCoreVersionChecker.VR_READY) { 186 if (checkerReturnValue == VrCoreVersionChecker.VR_READY) {
162 assertTrue(displayFound, vrDisplayFound(mWebContents)); 187 Assert.assertTrue(
163 assertFalse(barPresent, 188 displayFound, mVrTestRule.vrDisplayFound(mVrTestRule.getWebC ontents()));
189 Assert.assertFalse(barPresent,
164 VrUtils.isUpdateInstallInfoBarPresent( 190 VrUtils.isUpdateInstallInfoBarPresent(
165 getActivity().getWindow().getDecorView())); 191 mVrTestRule.getActivity().getWindow().getDecorView() ));
166 } else if (checkerReturnValue == VrCoreVersionChecker.VR_OUT_OF_DATE 192 } else if (checkerReturnValue == VrCoreVersionChecker.VR_OUT_OF_DATE
167 || checkerReturnValue == VrCoreVersionChecker.VR_NOT_AVAILABLE) { 193 || checkerReturnValue == VrCoreVersionChecker.VR_NOT_AVAILABLE) {
168 // Out of date and missing cases are the same, but with different te xt 194 // Out of date and missing cases are the same, but with different te xt
169 String expectedMessage, expectedButton; 195 String expectedMessage, expectedButton;
170 if (checkerReturnValue == VrCoreVersionChecker.VR_OUT_OF_DATE) { 196 if (checkerReturnValue == VrCoreVersionChecker.VR_OUT_OF_DATE) {
171 expectedMessage = 197 expectedMessage = mVrTestRule.getActivity().getString(
172 getActivity().getString(R.string.vr_services_check_infob ar_update_text); 198 R.string.vr_services_check_infobar_update_text);
173 expectedButton = 199 expectedButton = mVrTestRule.getActivity().getString(
174 getActivity().getString(R.string.vr_services_check_infob ar_update_button); 200 R.string.vr_services_check_infobar_update_button);
175 } else { 201 } else {
176 expectedMessage = 202 expectedMessage = mVrTestRule.getActivity().getString(
177 getActivity().getString(R.string.vr_services_check_infob ar_install_text); 203 R.string.vr_services_check_infobar_install_text);
178 expectedButton = 204 expectedButton = mVrTestRule.getActivity().getString(
179 getActivity().getString(R.string.vr_services_check_infob ar_install_button); 205 R.string.vr_services_check_infobar_install_button);
180 } 206 }
181 assertFalse(displayFound, vrDisplayFound(mWebContents)); 207 Assert.assertFalse(
182 assertTrue(barPresent, 208 displayFound, mVrTestRule.vrDisplayFound(mVrTestRule.getWebC ontents()));
209 Assert.assertTrue(barPresent,
183 VrUtils.isUpdateInstallInfoBarPresent( 210 VrUtils.isUpdateInstallInfoBarPresent(
184 getActivity().getWindow().getDecorView())); 211 mVrTestRule.getActivity().getWindow().getDecorView() ));
185 TextView tempView = (TextView) getActivity().getWindow().getDecorVie w().findViewById( 212 TextView tempView =
186 R.id.infobar_message); 213 (TextView) mVrTestRule.getActivity().getWindow().getDecorVie w().findViewById(
187 assertEquals(expectedMessage, tempView.getText().toString()); 214 R.id.infobar_message);
188 tempView = (TextView) getActivity().getWindow().getDecorView().findV iewById( 215 Assert.assertEquals(expectedMessage, tempView.getText().toString());
216 tempView = (TextView) mVrTestRule.getActivity().getWindow().getDecor View().findViewById(
189 R.id.button_primary); 217 R.id.button_primary);
190 assertEquals(expectedButton, tempView.getText().toString()); 218 Assert.assertEquals(expectedButton, tempView.getText().toString());
191 } else if (checkerReturnValue == VrCoreVersionChecker.VR_NOT_SUPPORTED) { 219 } else if (checkerReturnValue == VrCoreVersionChecker.VR_NOT_SUPPORTED) {
192 assertFalse(displayFound, vrDisplayFound(mWebContents)); 220 Assert.assertFalse(
193 assertFalse(barPresent, 221 displayFound, mVrTestRule.vrDisplayFound(mVrTestRule.getWebC ontents()));
222 Assert.assertFalse(barPresent,
194 VrUtils.isUpdateInstallInfoBarPresent( 223 VrUtils.isUpdateInstallInfoBarPresent(
195 getActivity().getWindow().getDecorView())); 224 mVrTestRule.getActivity().getWindow().getDecorView() ));
196 } else { 225 } else {
197 fail("Invalid VrCoreVersionChecker value: " + String.valueOf(checker ReturnValue)); 226 Assert.fail(
227 "Invalid VrCoreVersionChecker value: " + String.valueOf(chec kerReturnValue));
198 } 228 }
199 assertEquals(checkerReturnValue, mockChecker.getLastReturnValue()); 229 Assert.assertEquals(checkerReturnValue, mockChecker.getLastReturnValue() );
200 } 230 }
201 231
202 /** 232 /**
203 * Tests that the upgrade/install VR Services InfoBar is not present when VR Services is 233 * Tests that the upgrade/install VR Services InfoBar is not present when VR Services is
204 * installed and up to date. 234 * installed and up to date.
205 */ 235 */
236 @Test
206 @MediumTest 237 @MediumTest
207 public void testInfoBarNotPresentWhenVrServicesCurrent() throws InterruptedE xception { 238 public void testInfoBarNotPresentWhenVrServicesCurrent() throws InterruptedE xception {
208 infoBarTestHelper(VrCoreVersionChecker.VR_READY); 239 infoBarTestHelper(VrCoreVersionChecker.VR_READY);
209 } 240 }
210 241
211 /** 242 /**
212 * Tests that the upgrade VR Services InfoBar is present when VR Services is outdated. 243 * Tests that the upgrade VR Services InfoBar is present when VR Services is outdated.
213 */ 244 */
245 @Test
214 @MediumTest 246 @MediumTest
215 public void testInfoBarPresentWhenVrServicesOutdated() throws InterruptedExc eption { 247 public void testInfoBarPresentWhenVrServicesOutdated() throws InterruptedExc eption {
216 infoBarTestHelper(VrCoreVersionChecker.VR_OUT_OF_DATE); 248 infoBarTestHelper(VrCoreVersionChecker.VR_OUT_OF_DATE);
217 } 249 }
218 250
219 /** 251 /**
220 * Tests that the install VR Services InfoBar is present when VR Services is missing. 252 * Tests that the install VR Services InfoBar is present when VR Services is missing.
221 */ 253 */
254 @Test
222 @MediumTest 255 @MediumTest
223 public void testInfoBarPresentWhenVrServicesMissing() throws InterruptedExce ption { 256 public void testInfoBarPresentWhenVrServicesMissing() throws InterruptedExce ption {
224 infoBarTestHelper(VrCoreVersionChecker.VR_NOT_AVAILABLE); 257 infoBarTestHelper(VrCoreVersionChecker.VR_NOT_AVAILABLE);
225 } 258 }
226 259
227 /** 260 /**
228 * Tests that the install VR Services InfoBar is not present when VR is not supported on the 261 * Tests that the install VR Services InfoBar is not present when VR is not supported on the
229 * device. 262 * device.
230 */ 263 */
264 @Test
231 @MediumTest 265 @MediumTest
232 public void testInfoBarNotPresentWhenVrServicesNotSupported() throws Interru ptedException { 266 public void testInfoBarNotPresentWhenVrServicesNotSupported() throws Interru ptedException {
233 infoBarTestHelper(VrCoreVersionChecker.VR_NOT_SUPPORTED); 267 infoBarTestHelper(VrCoreVersionChecker.VR_NOT_SUPPORTED);
234 } 268 }
235 269
236 /** 270 /**
237 * Tests that the reported WebVR capabilities match expectations on the devi ces the WebVR tests 271 * Tests that the reported WebVR capabilities match expectations on the devi ces the WebVR tests
238 * are run on continuously. 272 * are run on continuously.
239 */ 273 */
274 @Test
240 @MediumTest 275 @MediumTest
241 public void testDeviceCapabilitiesMatchExpectations() throws InterruptedExce ption { 276 public void testDeviceCapabilitiesMatchExpectations() throws InterruptedExce ption {
242 String testName = "test_device_capabilities_match_expectations"; 277 String testName = "test_device_capabilities_match_expectations";
243 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 278 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
244 assertTrue("VRDisplayFound", vrDisplayFound(mWebContents)); 279 Assert.assertTrue(
245 executeStepAndWait("stepCheckDeviceCapabilities('" + Build.DEVICE + "')" , mWebContents); 280 "VRDisplayFound", mVrTestRule.vrDisplayFound(mVrTestRule.getWebC ontents()));
246 endTest(mWebContents); 281 mVrTestRule.executeStepAndWait("stepCheckDeviceCapabilities('" + Build.D EVICE + "')",
282 mVrTestRule.getWebContents());
283 mVrTestRule.endTest(mVrTestRule.getWebContents());
247 } 284 }
248 285
249 /** 286 /**
250 * Tests that focus is locked to the presenting display for purposes of VR i nput. 287 * Tests that focus is locked to the presenting display for purposes of VR i nput.
251 */ 288 */
289 @Test
252 @MediumTest 290 @MediumTest
253 @DisableIf.Build(message = "Flaky on L crbug.com/713781", 291 @DisableIf.Build(message = "Flaky on L crbug.com/713781",
254 sdk_is_greater_than = Build.VERSION_CODES.KITKAT, 292 sdk_is_greater_than = Build.VERSION_CODES.KITKAT,
255 sdk_is_less_than = Build.VERSION_CODES.M) 293 sdk_is_less_than = Build.VERSION_CODES.M)
256 public void testPresentationLocksFocus() throws InterruptedException { 294 public void testPresentationLocksFocus() throws InterruptedException {
257 String testName = "test_presentation_locks_focus"; 295 String testName = "test_presentation_locks_focus";
258 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 296 mVrTestRule.loadUrl(VrTestRule.getHtmlTestFile(testName), VrTestRule.PAG E_LOAD_TIMEOUT_S);
259 enterVrTapAndWait(mWebContents); 297 mVrTestRule.enterVrTapAndWait(mVrTestRule.getWebContents());
260 waitOnJavaScriptStep(mWebContents); 298 mVrTestRule.waitOnJavaScriptStep(mVrTestRule.getWebContents());
261 endTest(mWebContents); 299 mVrTestRule.endTest(mVrTestRule.getWebContents());
262 } 300 }
263 } 301 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698