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

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

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

Powered by Google App Engine
This is Rietveld 408576698