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

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

Issue 2727873002: Implement lazy initialization for VrShellDelegate (Closed)
Patch Set: Add comments + Fix test file Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 android.content.ActivityNotFoundException; 7 import android.content.ActivityNotFoundException;
8 import android.content.ComponentName; 8 import android.content.ComponentName;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 26 matching lines...) Expand all
37 private static final String DATA_KEY = "google.vr/data"; 37 private static final String DATA_KEY = "google.vr/data";
38 private static final ByteOrder BYTE_ORDER = ByteOrder.BIG_ENDIAN; 38 private static final ByteOrder BYTE_ORDER = ByteOrder.BIG_ENDIAN;
39 private static final int VIEWER_ID = 3; 39 private static final int VIEWER_ID = 3;
40 private static final int VERSION = 123; 40 private static final int VERSION = 123;
41 private static final int RESERVED = 456; 41 private static final int RESERVED = 456;
42 42
43 /** 43 /**
44 * Forces the browser into VR mode via a VrShellDelegate call. 44 * Forces the browser into VR mode via a VrShellDelegate call.
45 * @param vrDelegate The VRShellDelegate associated with this activity. 45 * @param vrDelegate The VRShellDelegate associated with this activity.
46 */ 46 */
47 public static void forceEnterVr(final VrShellDelegate vrDelegate) { 47 public static void forceEnterVr(final VrShellDelegate vrDelegate) {
bsheedy 2017/03/02 22:25:12 Nit: This input parameter is no longer used now th
mthiesse 2017/03/02 22:35:53 Done.
48 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 48 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
49 @Override 49 @Override
50 public void run() { 50 public void run() {
51 vrDelegate.enterVRIfNecessary(); 51 VrShellDelegate.enterVRIfNecessary();
52 } 52 }
53 }); 53 });
54 } 54 }
55 55
56 /** 56 /**
57 * Forces the browser out of VR mode via a VrShellDelegate call. 57 * Forces the browser out of VR mode via a VrShellDelegate call.
58 * @param vrDelegate The VRShellDelegate associated with this activity. 58 * @param vrDelegate The VRShellDelegate associated with this activity.
59 */ 59 */
60 public static void forceExitVr(final VrShellDelegate vrDelegate) { 60 public static void forceExitVr(final VrShellDelegate vrDelegate) {
61 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 61 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } catch (ActivityNotFoundException e) { 109 } catch (ActivityNotFoundException e) {
110 // On unsupported devices, won't find VrCore -> Do nothing 110 // On unsupported devices, won't find VrCore -> Do nothing
111 } 111 }
112 } 112 }
113 113
114 /** 114 /**
115 * Waits until the given VrShellDelegate's isInVR() returns true. Should 115 * Waits until the given VrShellDelegate's isInVR() returns true. Should
116 * only be used when VR Shell support is expected. 116 * only be used when VR Shell support is expected.
117 * @param delegate The delegate whose VR status will be polled 117 * @param delegate The delegate whose VR status will be polled
118 */ 118 */
119 public static void waitForVrSupported(final VrShellDelegate delegate) { 119 public static void waitForVrSupported(final VrShellDelegate delegate) {
bsheedy 2017/03/02 22:25:12 Nit: Also no longer used.
mthiesse 2017/03/02 22:35:53 Done.
120 // If VR Shell is supported, mInVr should eventually go to true 120 // If VR Shell is supported, mInVr should eventually go to true
121 // Relatively long timeout because sometimes GVR takes a while to enter VR 121 // Relatively long timeout because sometimes GVR takes a while to enter VR
122 CriteriaHelper.pollUiThread(Criteria.equals(true, new Callable<Boolean>( ) { 122 CriteriaHelper.pollUiThread(Criteria.equals(true, new Callable<Boolean>( ) {
123 @Override 123 @Override
124 public Boolean call() { 124 public Boolean call() {
125 return delegate.isInVR(); 125 return VrShellDelegate.isInVR();
126 } 126 }
127 }), 10000, 50); 127 }), 10000, 50);
128 } 128 }
129 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698