OLD | NEW |
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 /** | 7 /** |
8 * Mock version of VrCoreVersionCheckerImpl that allows setting of the return | 8 * Mock version of VrCoreVersionCheckerImpl that allows setting of the return |
9 * value. | 9 * value. |
10 */ | 10 */ |
11 public class MockVrCoreVersionCheckerImpl extends VrCoreVersionCheckerImpl { | 11 public class MockVrCoreVersionCheckerImpl extends VrCoreVersionCheckerImpl { |
12 private boolean mUseActualImplementation; | 12 private boolean mUseActualImplementation; |
13 private int mMockReturnValue = VrCoreVersionChecker.VR_READY; | 13 private VrCoreInfo mMockReturnValue = new VrCoreInfo(null, VrCoreCompatibili
ty.VR_READY); |
14 private int mLastReturnValue = -1; | 14 private VrCoreInfo mLastReturnValue = null; |
15 | 15 |
16 @Override | 16 @Override |
17 public int getVrCoreCompatibility() { | 17 public VrCoreInfo getVrCoreInfo() { |
18 mLastReturnValue = | 18 mLastReturnValue = mUseActualImplementation ? super.getVrCoreInfo() : mM
ockReturnValue; |
19 mUseActualImplementation ? super.getVrCoreCompatibility() : mMoc
kReturnValue; | |
20 return mLastReturnValue; | 19 return mLastReturnValue; |
21 } | 20 } |
22 | 21 |
23 public int getLastReturnValue() { | 22 public VrCoreInfo getLastReturnValue() { |
24 return mLastReturnValue; | 23 return mLastReturnValue; |
25 } | 24 } |
26 | 25 |
27 public void setMockReturnValue(int value) { | 26 public void setMockReturnValue(VrCoreInfo value) { |
28 mMockReturnValue = value; | 27 mMockReturnValue = value; |
29 } | 28 } |
30 | 29 |
31 public void setUseActualImplementation(boolean useActual) { | 30 public void setUseActualImplementation(boolean useActual) { |
32 mUseActualImplementation = useActual; | 31 mUseActualImplementation = useActual; |
33 } | 32 } |
34 } | 33 } |
OLD | NEW |