Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new test for updateRenderState() #24415

Merged

Conversation

svillar
Copy link
Contributor

@svillar svillar commented Jul 1, 2020

This PR adds a new test for the updateRenderState() algorithm described https://immersive-web.github.io/webxr/#dom-xrsession-updaterenderstate.

assert(tempSession);
assert_not_equals(session, tempSession);
session.updateRenderState({ baseLayer : new XRWebGLLayer(tempSession, sessionObjects.gl), });
assert_unreached("updateRenderState should fail when baseLayer is created with a different session");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just assert_throws this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@svillar
Copy link
Contributor Author

svillar commented Jul 6, 2020

@Manishearth mind taking another look? Thanks!

resolve(session.end().then(() => {
try {
session.updateRenderState({});
assert_unreached("updateRenderState should fail when created with an ended session");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_throws please

return new Promise((resolve, reject) => {
try {
session.updateRenderState({ inlineVerticalFieldOfView : Math.PI, });
assert_unreached("updateRenderState should fail when specifying an inlineVerticalFieldOfView with immersive sessions");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_throws please

Copy link
Contributor

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


let testFieldOfView = function(session, fakeDeviceController, t) {
return new Promise((resolve, reject) => {
assert_throws_dom('InvalidStateError', () => session.updateRenderState({ inlineVerticalFieldOfView : Math.PI, }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test already exists via: webxr/render_state_vertical_fov_inline.https.html

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, and also throwing isn't technically compliant: https://immersive-web.github.io/webxr/#apply-the-pending-render-state

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they're testing two different things. I'm trying to test the updateRenderState() API (which indeed throws) while the test you mention is actually testing the apply render state if I am not wrong

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, step 11 from that algorithm https://immersive-web.github.io/webxr/#dom-xrsession-updaterenderstate
Doesn't mention any validation to inlineVerticalFieldOfView except for throwing if it's set and being applied to an immersive session.
Applying the pending render state is where any validation actually happens, and that happens by clamping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually... I just looked closer, and this is setting to an immersive session (Not sure why I assumed it was setting on an inline session...).

That is also already tested via: webxr/render_state_vertical_fov_immersive.https.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, step 11 from that algorithm https://immersive-web.github.io/webxr/#dom-xrsession-updaterenderstate
Doesn't mention any validation to inlineVerticalFieldOfView except for throwing if it's set and being applied to an immersive session.
Applying the pending render state is where any validation actually happens, and that happens by clamping.

Then I might be missunderstanding the specs. What I am trying to test is step 4 of updateRenderState(), that's before the step 11 you mention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be crystal clear, I don't want to test the validation at all (as you said there are 2 other tests for that), I just want to test the first 5 steps of the update algorithm.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah; sorry, my initial understanding was wrong and I thought it was the step 11; however step 4 is still tested (though it doesn't use assert_throws and ~implements that itself) in this test: https://github.com/web-platform-tests/wpt/blob/master/webxr/render_state_vertical_fov_immersive.https.html
(Similar name to the one I initially linked, but replicates this test).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I understand that you prefer to remove it then. I'll understand silence as a confirmation :)

assert_not_equals(session.renderState.baseLayer, layer);
});
} catch (err) {
assert_unreached("updateRenderState should not fail (actually not do anything) with no params");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Copy paste error, please update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, I'll fix that.

@alcooper91
Copy link
Contributor

General comment, please wrap all asserts in t.step(() => { // foo };
I believe that failures don't get reported to the testharness cleanly otherwise.

That's probably something we should look into in webxr_util.js at a future date (I think it has to do with how we resolve the function, but it may be an unavoidable side-effect of how the tests assert within a promise/callback that isn't directly part of the chain...)

@svillar
Copy link
Contributor Author

svillar commented Jul 10, 2020

General comment, please wrap all asserts in t.step(() => { // foo };
I believe that failures don't get reported to the testharness cleanly otherwise.

Sure, I'll do that. Thanks for the suggestion.

@svillar
Copy link
Contributor Author

svillar commented Jul 31, 2020

Thanks for the patience. I was on holidays so I couldn't update this before. PTAL.

Copy link
Contributor

@alcooper91 alcooper91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

let gl = sessionObjects.gl;
try {
gl.makeXRCompatible().then(() => {
t.step(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NitPick: Only the asserts really need to be in the t.step, though I don't think this hurts anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just basically did it because I saw other tests with whole code blocks inside it.

@svillar
Copy link
Contributor Author

svillar commented Jul 31, 2020

TC reports that wpt-decision-task is pending but when clicking on "Details" it says it was completed. What's going on?

@svillar
Copy link
Contributor Author

svillar commented Aug 3, 2020

@Manishearth @alcooper91 do we really need @klausw's and @toji's approvals? Or are there any other additional actions expected from my side?

@Manishearth
Copy link
Contributor

Alex's review should be fine

@svillar
Copy link
Contributor Author

svillar commented Aug 4, 2020

Alex's review should be fine

Any idea why some checks are not apparently completed?

@Manishearth
Copy link
Contributor

Alex might not have merge access to this repo? But I do, and even with my review it's not working

@Manishearth Manishearth closed this Aug 4, 2020
@Manishearth Manishearth reopened this Aug 4, 2020
@Manishearth
Copy link
Contributor

Retriggered the build

@svillar
Copy link
Contributor Author

svillar commented Aug 5, 2020

Retriggered the build

Seems like it didn't work either

@Manishearth
Copy link
Contributor

Cc @stephenmcgruer ?

@stephenmcgruer
Copy link
Contributor

Huh. This looks like it could be a Taskcluster bug - the actual task succeeded (https://community-tc.services.mozilla.com/tasks/groups/MKIoi4r8QxyD-pea0sz9kw are all green) but Taskcluster isn't reporting the status to GitHub... thanks for the tag - I'll admin merge and keep an eye out for more reports of this nature.

@stephenmcgruer stephenmcgruer merged commit 631a86c into web-platform-tests:master Aug 5, 2020
@svillar
Copy link
Contributor Author

svillar commented Aug 6, 2020

Huh. This looks like it could be a Taskcluster bug - the actual task succeeded (https://community-tc.services.mozilla.com/tasks/groups/MKIoi4r8QxyD-pea0sz9kw are all green) but Taskcluster isn't reporting the status to GitHub... thanks for the tag - I'll admin merge and keep an eye out for more reports of this nature.

Thanks @stephenmcgruer !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants