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

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

Issue 2881233002: WebVR: lock focus while presenting to presenting window (Closed)
Patch Set: 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 | « no previous file | chrome/test/data/android/webvr_instrumentation/html/test_presentation_locks_focus.html » ('j') | 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_CHECK_INTERVAL_L ONG_MS; 7 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_CHECK_INTERVAL_L ONG_MS;
8 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_CHECK_INTERVAL_S HORT_MS; 8 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_CHECK_INTERVAL_S HORT_MS;
9 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_LONG_MS; 9 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_LONG_MS;
10 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_SHORT_MS ; 10 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_SHORT_MS ;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 public void testRequestPresentEntersVr() throws InterruptedException { 232 public void testRequestPresentEntersVr() throws InterruptedException {
233 String testName = "test_requestPresent_enters_vr"; 233 String testName = "test_requestPresent_enters_vr";
234 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 234 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S);
235 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); 235 assertTrue("VRDisplay found", vrDisplayFound(mWebContents));
236 enterVrTapAndWait(mWebContents); 236 enterVrTapAndWait(mWebContents);
237 assertTrue("VrShellDelegate is in VR", VrShellDelegate.isInVr()); 237 assertTrue("VrShellDelegate is in VR", VrShellDelegate.isInVr());
238 endTest(mWebContents); 238 endTest(mWebContents);
239 } 239 }
240 240
241 /** 241 /**
242 * Tests that scanning the Daydream View NFC tag on supported devices 242 * Tests that scanning the Daydream View NFC tag on supported devices fires the
243 * fires the vrdisplayactivate event. 243 * vrdisplayactivate event.
244 */ 244 */
245 @SmallTest 245 @SmallTest
246 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) 246 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM)
247 public void testNfcFiresVrdisplayactivate() throws InterruptedException { 247 public void testNfcFiresVrdisplayactivate() throws InterruptedException {
248 String testName = "test_nfc_fires_vrdisplayactivate"; 248 String testName = "test_nfc_fires_vrdisplayactivate";
249 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 249 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S);
250 simNfcScanAndWait(mWebContents); 250 simNfcScanAndWait(mWebContents);
251 endTest(mWebContents); 251 endTest(mWebContents);
252 } 252 }
253 253
254 /** 254 /**
255 * Tests that screen touches are not registered when the viewer is a 255 * Tests that screen touches are not registered when the viewer is a Daydrea m View.
256 * Daydream View.
257 */ 256 */
258 @LargeTest 257 @LargeTest
259 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) 258 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM)
260 public void testScreenTapsNotRegisteredOnDaydream() throws InterruptedExcept ion { 259 public void testScreenTapsNotRegisteredOnDaydream() throws InterruptedExcept ion {
261 String testName = "test_screen_taps_not_registered_on_daydream"; 260 String testName = "test_screen_taps_not_registered_on_daydream";
262 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 261 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S);
263 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); 262 assertTrue("VRDisplay found", vrDisplayFound(mWebContents));
264 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents); 263 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents);
265 enterVrTapAndWait(mWebContents); 264 enterVrTapAndWait(mWebContents);
266 // Wait on VrShellImpl to say that its parent consumed the touch event 265 // Wait on VrShellImpl to say that its parent consumed the touch event
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); 310 assertTrue("VRDisplay found", vrDisplayFound(mWebContents));
312 executeStepAndWait("stepCheckFrameDataWhileFocusedTab()", mWebContents); 311 executeStepAndWait("stepCheckFrameDataWhileFocusedTab()", mWebContents);
313 312
314 loadUrlInNewTab("about:blank"); 313 loadUrlInNewTab("about:blank");
315 314
316 executeStepAndWait("stepCheckFrameDataWhileNonFocusedTab()", mWebContent s); 315 executeStepAndWait("stepCheckFrameDataWhileNonFocusedTab()", mWebContent s);
317 endTest(mWebContents); 316 endTest(mWebContents);
318 } 317 }
319 318
320 /** 319 /**
321 * Helper function to run the tests checking for the upgrade/install InfoBar 320 * Helper function to run the tests checking for the upgrade/install InfoBar being present since
322 * being present since all that differs is the value returned by VrCoreVersi onChecker 321 * all that differs is the value returned by VrCoreVersionChecker and a coup le asserts.
323 * and a couple asserts. 322 *
324 * @param checkerReturnValue The value to have the VrCoreVersionChecker retu rn 323 * @param checkerReturnValue The value to have the VrCoreVersionChecker retu rn
325 */ 324 */
326 private void infoBarTestHelper(int checkerReturnValue) throws InterruptedExc eption { 325 private void infoBarTestHelper(int checkerReturnValue) throws InterruptedExc eption {
327 MockVrCoreVersionCheckerImpl mockChecker = new MockVrCoreVersionCheckerI mpl(); 326 MockVrCoreVersionCheckerImpl mockChecker = new MockVrCoreVersionCheckerI mpl();
328 mockChecker.setMockReturnValue(checkerReturnValue); 327 mockChecker.setMockReturnValue(checkerReturnValue);
329 VrShellDelegate.getInstanceForTesting().overrideVrCoreVersionCheckerForT esting(mockChecker); 328 VrShellDelegate.getInstanceForTesting().overrideVrCoreVersionCheckerForT esting(mockChecker);
330 String testName = "generic_webvr_page"; 329 String testName = "generic_webvr_page";
331 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 330 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S);
332 String displayFound = "VRDisplay Found"; 331 String displayFound = "VRDisplay Found";
333 String barPresent = "InfoBar present"; 332 String barPresent = "InfoBar present";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 assertFalse(barPresent, 365 assertFalse(barPresent,
367 VrUtils.isUpdateInstallInfoBarPresent( 366 VrUtils.isUpdateInstallInfoBarPresent(
368 getActivity().getWindow().getDecorView())); 367 getActivity().getWindow().getDecorView()));
369 } else { 368 } else {
370 fail("Invalid VrCoreVersionChecker value: " + String.valueOf(checker ReturnValue)); 369 fail("Invalid VrCoreVersionChecker value: " + String.valueOf(checker ReturnValue));
371 } 370 }
372 assertEquals(checkerReturnValue, mockChecker.getLastReturnValue()); 371 assertEquals(checkerReturnValue, mockChecker.getLastReturnValue());
373 } 372 }
374 373
375 /** 374 /**
376 * Tests that the upgrade/install VR Services InfoBar is not present when 375 * Tests that the upgrade/install VR Services InfoBar is not present when VR Services is
377 * VR Services is installed and up to date. 376 * installed and up to date.
378 */ 377 */
379 @MediumTest 378 @MediumTest
380 public void testInfoBarNotPresentWhenVrServicesCurrent() throws InterruptedE xception { 379 public void testInfoBarNotPresentWhenVrServicesCurrent() throws InterruptedE xception {
381 infoBarTestHelper(VrCoreVersionChecker.VR_READY); 380 infoBarTestHelper(VrCoreVersionChecker.VR_READY);
382 } 381 }
383 382
384 /** 383 /**
385 * Tests that the upgrade VR Services InfoBar is present when 384 * Tests that the upgrade VR Services InfoBar is present when VR Services is outdated.
386 * VR Services is outdated.
387 */ 385 */
388 @MediumTest 386 @MediumTest
389 public void testInfoBarPresentWhenVrServicesOutdated() throws InterruptedExc eption { 387 public void testInfoBarPresentWhenVrServicesOutdated() throws InterruptedExc eption {
390 infoBarTestHelper(VrCoreVersionChecker.VR_OUT_OF_DATE); 388 infoBarTestHelper(VrCoreVersionChecker.VR_OUT_OF_DATE);
391 } 389 }
392 390
393 /** 391 /**
394 * Tests that the install VR Services InfoBar is present when VR 392 * Tests that the install VR Services InfoBar is present when VR Services is missing.
395 * Services is missing.
396 */ 393 */
397 @MediumTest 394 @MediumTest
398 public void testInfoBarPresentWhenVrServicesMissing() throws InterruptedExce ption { 395 public void testInfoBarPresentWhenVrServicesMissing() throws InterruptedExce ption {
399 infoBarTestHelper(VrCoreVersionChecker.VR_NOT_AVAILABLE); 396 infoBarTestHelper(VrCoreVersionChecker.VR_NOT_AVAILABLE);
400 } 397 }
401 398
402 /** 399 /**
403 * Tests that the install VR Services InfoBar is not present when VR 400 * Tests that the install VR Services InfoBar is not present when VR is not supported on the
404 * is not supported on the device. 401 * device.
405 */ 402 */
406 @MediumTest 403 @MediumTest
407 public void testInfoBarNotPresentWhenVrServicesNotSupported() throws Interru ptedException { 404 public void testInfoBarNotPresentWhenVrServicesNotSupported() throws Interru ptedException {
408 infoBarTestHelper(VrCoreVersionChecker.VR_NOT_SUPPORTED); 405 infoBarTestHelper(VrCoreVersionChecker.VR_NOT_SUPPORTED);
409 } 406 }
410 407
411 /** 408 /**
412 * Tests that the reported WebVR capabilities match expectations on the 409 * Tests that the reported WebVR capabilities match expectations on the devi ces the WebVR tests
413 * devices the WebVR tests are run on continuously. 410 * are run on continuously.
414 */ 411 */
415 @MediumTest 412 @MediumTest
416 public void testDeviceCapabilitiesMatchExpectations() throws InterruptedExce ption { 413 public void testDeviceCapabilitiesMatchExpectations() throws InterruptedExce ption {
417 String testName = "test_device_capabilities_match_expectations"; 414 String testName = "test_device_capabilities_match_expectations";
418 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S); 415 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S);
419 assertTrue("VRDisplayFound", vrDisplayFound(mWebContents)); 416 assertTrue("VRDisplayFound", vrDisplayFound(mWebContents));
420 executeStepAndWait("stepCheckDeviceCapabilities('" + Build.DEVICE + "')" , mWebContents); 417 executeStepAndWait("stepCheckDeviceCapabilities('" + Build.DEVICE + "')" , mWebContents);
421 endTest(mWebContents); 418 endTest(mWebContents);
422 } 419 }
420
421 /**
422 * Tests that focus is locked to the presenting display for purposes of VR i nput.
423 */
424 @MediumTest
425 public void testPresentationLocksFocus() throws InterruptedException {
426 String testName = "test_presentation_locks_focus";
427 loadUrl(getHtmlTestFile(testName), PAGE_LOAD_TIMEOUT_S);
428 enterVrTapAndWait(mWebContents);
429 waitOnJavaScriptStep(mWebContents);
430 endTest(mWebContents);
431 }
423 } 432 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/android/webvr_instrumentation/html/test_presentation_locks_focus.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698