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 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_V IEWER_DAYDREAM; | 7 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_NON_DAYDREAM; | 8 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_W EBVR_SUPPORTED; | 9 import static org.chromium.chrome.test.util.ChromeRestriction.RESTRICTION_TYPE_W EBVR_SUPPORTED; |
10 | 10 |
11 import android.os.SystemClock; | |
11 import android.support.test.filters.SmallTest; | 12 import android.support.test.filters.SmallTest; |
12 | 13 |
13 import org.chromium.base.Log; | 14 import org.chromium.base.Log; |
14 import org.chromium.base.test.util.CommandLineFlags; | 15 import org.chromium.base.test.util.CommandLineFlags; |
15 import org.chromium.base.test.util.Restriction; | 16 import org.chromium.base.test.util.Restriction; |
16 import org.chromium.base.test.util.UrlUtils; | 17 import org.chromium.base.test.util.UrlUtils; |
17 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; | 18 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; |
18 import org.chromium.content.browser.test.util.ClickUtils; | 19 import org.chromium.content.browser.test.util.ClickUtils; |
19 import org.chromium.content.browser.test.util.Criteria; | 20 import org.chromium.content.browser.test.util.Criteria; |
20 import org.chromium.content.browser.test.util.CriteriaHelper; | 21 import org.chromium.content.browser.test.util.CriteriaHelper; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 String testName = "test_nfc_fires_vrdisplayactivate"; | 243 String testName = "test_nfc_fires_vrdisplayactivate"; |
243 loadUrl(getHtmlTestFile(testName), 10); | 244 loadUrl(getHtmlTestFile(testName), 10); |
244 simNfcScanAndWait(mWebContents); | 245 simNfcScanAndWait(mWebContents); |
245 endTest(mWebContents); | 246 endTest(mWebContents); |
246 } | 247 } |
247 | 248 |
248 /** | 249 /** |
249 * Tests that screen touches are not registered when the viewer is a | 250 * Tests that screen touches are not registered when the viewer is a |
250 * Daydream View. | 251 * Daydream View. |
251 */ | 252 */ |
252 @SmallTest | 253 @SmallTest |
Ted C
2017/03/27 15:44:06
This should likely be a LargeTest (and probably sh
bsheedy
2017/03/27 20:19:12
Done.
| |
253 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) | 254 @Restriction(RESTRICTION_TYPE_VIEWER_DAYDREAM) |
254 public void testScreenTapsNotRegisteredOnDaydream() throws InterruptedExcept ion { | 255 public void testScreenTapsNotRegisteredOnDaydream() throws InterruptedExcept ion { |
255 String testName = "test_screen_taps_not_registered_on_daydream"; | 256 String testName = "test_screen_taps_not_registered_on_daydream"; |
256 loadUrl(getHtmlTestFile(testName), 10); | 257 loadUrl(getHtmlTestFile(testName), 10); |
257 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); | 258 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); |
258 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents); | 259 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents); |
259 enterVrTapAndWait(mWebContents); | 260 enterVrTapAndWait(mWebContents); |
260 enterVrTap(); | 261 // Checking for a tap in Javascript immediately after sending one can re sult |
262 // in the check happening before the click event is fired, which would c ause | |
263 // this test to pass even if the click would have been registered. Solut ion | |
264 // is to send several over a short period to make sure there's enough ti me | |
265 for (int i = 0; i < 5; i++) { | |
Ted C
2017/03/27 15:44:06
What is the goal of the test? Are we trying to se
bsheedy
2017/03/27 20:19:12
The purpose is to test that tapping on the screen
| |
266 enterVrTap(); | |
267 SystemClock.sleep(50); | |
268 } | |
261 executeStepAndWait("stepVerifyNoAdditionalTaps()", mWebContents); | 269 executeStepAndWait("stepVerifyNoAdditionalTaps()", mWebContents); |
262 endTest(mWebContents); | 270 endTest(mWebContents); |
263 } | 271 } |
264 | 272 |
265 /** | 273 /** |
266 * Tests that screen touches are still registered when the viewer is | 274 * Tests that screen touches are still registered when the viewer is |
267 * Cardboard. | 275 * Cardboard. |
268 */ | 276 */ |
269 @SmallTest | 277 @SmallTest |
270 @Restriction(RESTRICTION_TYPE_VIEWER_NON_DAYDREAM) | 278 @Restriction(RESTRICTION_TYPE_VIEWER_NON_DAYDREAM) |
271 public void testScreenTapsRegisteredOnCardboard() throws InterruptedExceptio n { | 279 public void testScreenTapsRegisteredOnCardboard() throws InterruptedExceptio n { |
272 String testName = "test_screen_taps_registered_on_cardboard"; | 280 String testName = "test_screen_taps_registered_on_cardboard"; |
273 loadUrl(getHtmlTestFile(testName), 10); | 281 loadUrl(getHtmlTestFile(testName), 10); |
274 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); | 282 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); |
275 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents); | 283 executeStepAndWait("stepVerifyNoInitialTaps()", mWebContents); |
284 // Tap and wait to enter VR | |
276 enterVrTapAndWait(mWebContents); | 285 enterVrTapAndWait(mWebContents); |
277 enterVrTap(); | 286 // Tap and wait for Javascript to receive it |
278 executeStepAndWait("stepVerifyAdditionalTap()", mWebContents); | 287 enterVrTapAndWait(mWebContents); |
279 endTest(mWebContents); | 288 endTest(mWebContents); |
280 } | 289 } |
281 | 290 |
282 /** | 291 /** |
283 * Tests that non-focused tabs cannot get pose information. | 292 * Tests that non-focused tabs cannot get pose information. |
284 */ | 293 */ |
285 @SmallTest | 294 @SmallTest |
286 public void testPoseDataUnfocusedTab() throws InterruptedException { | 295 public void testPoseDataUnfocusedTab() throws InterruptedException { |
287 String testName = "test_pose_data_unfocused_tab"; | 296 String testName = "test_pose_data_unfocused_tab"; |
288 loadUrl(getHtmlTestFile(testName), 10); | 297 loadUrl(getHtmlTestFile(testName), 10); |
289 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); | 298 assertTrue("VRDisplay found", vrDisplayFound(mWebContents)); |
290 executeStepAndWait("stepCheckFrameDataWhileFocusedTab()", mWebContents); | 299 executeStepAndWait("stepCheckFrameDataWhileFocusedTab()", mWebContents); |
291 | 300 |
292 loadUrlInNewTab("about:blank"); | 301 loadUrlInNewTab("about:blank"); |
293 | 302 |
294 executeStepAndWait("stepCheckFrameDataWhileNonFocusedTab()", mWebContent s); | 303 executeStepAndWait("stepCheckFrameDataWhileNonFocusedTab()", mWebContent s); |
295 endTest(mWebContents); | 304 endTest(mWebContents); |
296 } | 305 } |
297 } | 306 } |
OLD | NEW |