This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fbshipit-source-id: d824f6c0bc73943e6f652110a3eb550e2f0f0f46
- Loading branch information
FBShipIt
committed
Apr 18, 2017
0 parents
commit a284d2b
Showing
363 changed files
with
172,504 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
**/ReactVR/js/defs/* | ||
website/ | ||
**/*.bundle.js | ||
**/node_modules/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module.exports = { | ||
extends: [ | ||
'fbjs', | ||
'prettier' | ||
], | ||
|
||
plugins: [ | ||
"prettier", | ||
], | ||
|
||
rules: { | ||
'accessor-pairs': 'off', | ||
'consistent-return': 'off', | ||
'eqeqeq': 'error', | ||
'key-spacing': ['warn', {beforeColon: false, afterColon: true}], | ||
'max-len': ['warn', {code: 120, ignoreComments: true}], | ||
'no-bitwise': 'off', | ||
'no-tabs': 'warn', | ||
'no-var': 'warn', | ||
'object-curly-spacing': ['warn', 'never'], | ||
'prefer-const': ['warn', {destructuring: 'all'}], | ||
'space-in-parens': 'warn', | ||
|
||
// Prettier | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"bracketSpacing": false, | ||
"jsxBracketSameLine": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"printWidth": 100, | ||
} | ||
] | ||
}, | ||
globals: { | ||
'__DEV__': true, | ||
'__dirname': false, | ||
'__fbBatchedBridgeConfig': false, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ignore] | ||
.*/Libraries/.* | ||
.*/docs/.* | ||
.*/EndToEnd/.* | ||
.*/jest/.* | ||
.*/website/.* | ||
.*/__tests__/.* | ||
<PROJECT_ROOT>/node_modules/.* | ||
|
||
[include] | ||
|
||
[libs] | ||
ReactVR/js/defs/ | ||
|
||
[options] | ||
emoji=true | ||
|
||
module.ignore_non_literal_requires=true | ||
unsafe.enable_getters_and_setters=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.sh text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
We use GitHub Issues for bugs and support tracking for the preview | ||
|
||
--- Please use this template, and delete everything above this line before submitting your issue --- | ||
|
||
### Description | ||
|
||
[FILL THIS OUT: Bug or Feature Request? For a Bug please explain what you did, what you expected to happen, and what actually happens. Sections below] | ||
|
||
#### Expected behavior | ||
|
||
#### Actual behavior | ||
|
||
### Reproduction | ||
|
||
[FILL THIS OUT: Try to reproduce your bug in a minimal example, maybe you could alter one of the samples to demonstrate the problem] | ||
|
||
### Solution | ||
|
||
[FILL THIS OUT: What needs to be done to address this issue? Ideally, provide source code or a patch with a fix.] | ||
|
||
### Additional Information | ||
|
||
* React VR version: [FILL THIS OUT: both react-vr and react-vr-web] | ||
* Operating System: [FILL THIS OUT: MacOS, Linux, or Windows?] | ||
* Graphics Card: [FILL THIS OUT: NVIDA, ATI, Intel? Which Driver?] | ||
* Browser: [FILL THIS OUT: Carmel, Chrome, Edge, Safari? Which version?] | ||
* VR Device: [FILL THIS OUT: In or Out of VR? Headset? ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Thanks for submitting a PR! Please read these instructions carefully: | ||
|
||
- [ ] Explain the **motivation** for making this change. | ||
- [ ] Provide a **test plan** demonstrating that the code is solid. | ||
- [ ] Match the **code formatting** of the rest of the codebase. | ||
|
||
## Motivation (required) | ||
|
||
What existing problem does the pull request solve? | ||
|
||
## Test Plan (required) | ||
|
||
A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more. | ||
|
||
If you have added code that should be tested, add tests. | ||
|
||
## Next Steps | ||
|
||
Sign the [CLA][2], if you haven't already. | ||
|
||
Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it. | ||
|
||
Make sure all **tests pass** on [Circle CI][3]. PRs that break tests are unlikely to be merged. | ||
|
||
For more info, see the ["Pull Requests"][4] section of our "Contributing" guidelines. | ||
|
||
[1]: https://medium.com/@martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9 | ||
[2]: https://code.facebook.com/cla | ||
[3]: http://circleci.com/gh/facebook/react-native | ||
[4]: https://github.com/facebook/react-vr/blob/master/CONTRIBUTING.md#pull-requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
coverage/ | ||
node_modules | ||
*~ | ||
.DS_Store | ||
*.log | ||
EndToEnd/testapp/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Contributing to React VR | ||
|
||
React VR is actively being developed by Oculus and Facebook, and is used to power a growing number of internal and external applications. We've put together this document to help make the public contribution process clearer and answer any questions you may have. | ||
|
||
## Pull Requests | ||
|
||
Our core team will be monitoring for pull requests. New pull requests will automatically run against our continuous integration suite, which should detect the majority of formatting and testing issues. After this, one of our team members will run some Facebook-specific integration tests on it, to make sure it doesn't break any of our applications. Once that has completed, one member of the team will sign off on the changes and merge the pull request. Any API changes might require us to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback in a timely manner throughout the process. | ||
|
||
Before submitting a pull request, please make sure you have done the following: | ||
|
||
1. Fork the repository and fork your working branch from master | ||
2. Describe your test plan in your Pull Request | ||
- If you've added new features, cover them with tests | ||
- If you've changed APIs, update the appropriate documentation | ||
3. Ensure all test suites pass (`npm test`) | ||
4. Ensure the linter doesn't return any errors (`npm run lint`) | ||
5. Ensure that Flow typechecking is sound (`npm run flow`) | ||
6. Make sure you've completed the CLA. | ||
|
||
## Copyright Notice for Files | ||
|
||
Copy and paste this to the tope of your new files: | ||
|
||
``` | ||
/** | ||
* Copyright (c) 2017-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
``` | ||
|
||
## Contributor License Agreement (CLA) | ||
|
||
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, just let us know that you have completed the CLA and we can cross-check with your GitHub username. | ||
|
||
[Complete your CLA here](https://code.facebook.com/cla) | ||
|
||
## License | ||
|
||
By contributing to React, you agree that your contributions will be licensed under its BSD license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
jest | ||
.dontMock('../runner/MockBlob') | ||
.dontMock('../runner/MockURL') | ||
.dontMock('../runner/MockWorker') | ||
.dontMock('../runner/Runner') | ||
.dontMock('../runner/MockCanvas') | ||
.dontMock('path') | ||
.mock('canvas', () => require('../runner/MockCanvas').default, {virtual: true}); | ||
|
||
const Runner = require('../runner/Runner').default; | ||
const path = require('path'); | ||
|
||
process.chdir(path.resolve(__dirname, '..')); | ||
|
||
const html = ` | ||
<html> | ||
<body> | ||
<script src="./testapp/build/client.bundle.js"></script> | ||
<script> | ||
ReactVR.init( | ||
'./testapp/build/e2e.bundle.js', | ||
document.body | ||
); | ||
</script> | ||
</body> | ||
</html> | ||
`; | ||
|
||
describe('React Bridge', () => { | ||
it('exposes Native Modules', () => { | ||
const runner = new Runner(html, {}); | ||
return runner.loaded.then((window) => { | ||
const workerWindow = window.vr.rootView.context.worker.sandbox.window; | ||
expect(workerWindow.NativeModules).toBeTruthy(); | ||
const vrConstants = workerWindow.NativeModules.ReactVRConstants; | ||
expect(vrConstants.Runtime).toBe('WebVR'); | ||
}); | ||
}); | ||
|
||
it('constructs the scene', () => { | ||
const runner = new Runner(html, {}); | ||
return runner.loaded.then((window) => { | ||
const top = window.vr.scene.children[0].children[0]; | ||
expect(top).toBeTruthy(); | ||
expect(top.type).toBe('UIView'); | ||
expect(top.children[0].type).toBe('SDFText'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
jest | ||
.dontMock('../runner/MockBlob') | ||
.dontMock('../runner/MockURL') | ||
.dontMock('../runner/MockWorker') | ||
.dontMock('../runner/Runner'); | ||
|
||
const Runner = require('../runner/Runner').default; | ||
|
||
process.chdir(__dirname); | ||
|
||
describe('End to End Test Runner', () => { | ||
it('loads injected contents', () => { | ||
const runner = new Runner( | ||
`<html><script src="./mocked.js"></script></html>`, | ||
{ | ||
'/mocked.js': 'window.mockedLoaded = true;', | ||
} | ||
); | ||
return runner.loaded.then((window) => { | ||
expect(window.mockedLoaded).toBe(true); | ||
}); | ||
}); | ||
|
||
it('loads contents from the filesystem', () => { | ||
const runner = new Runner( | ||
`<html><script src="./loadingtest.res.js"></script></html>`, | ||
{} | ||
); | ||
return runner.loaded.then((window) => { | ||
expect(window.loadedFile).toBe(true); | ||
}); | ||
}); | ||
|
||
it('loads injected contents in the worker', () => { | ||
const runner = new Runner( | ||
` | ||
<html> | ||
<script> | ||
window.worker = new Worker('worker.js'); | ||
</script> | ||
</html>`, | ||
{'worker.js': 'self.workerLoaded = true;'}, | ||
); | ||
return runner.loaded.then((window) => { | ||
expect(window.worker.sandbox.workerLoaded).toBe(true); | ||
}); | ||
}); | ||
|
||
it('loads filesystem contents in the worker', () => { | ||
const runner = new Runner( | ||
` | ||
<html> | ||
<script> | ||
window.worker = new Worker('loadingtest.res.js'); | ||
</script> | ||
</html>`, | ||
{}, | ||
); | ||
return runner.loaded.then((window) => { | ||
expect(window.worker.sandbox.loadedFile).toBe(true); | ||
}); | ||
}); | ||
|
||
it('loads injected content via importScripts', () => { | ||
const runner = new Runner( | ||
` | ||
<html> | ||
<script> | ||
window.worker = new Worker('worker.js'); | ||
</script> | ||
</html>`, | ||
{'worker.js': 'importScripts("part2.js")', 'part2.js': 'self.part2loaded = true;'}, | ||
); | ||
return runner.loaded.then((window) => { | ||
expect(window.worker.sandbox.part2loaded).toBe(true); | ||
}); | ||
}); | ||
|
||
it('loads filesystem content via importScripts', () => { | ||
const runner = new Runner( | ||
` | ||
<html> | ||
<script> | ||
window.worker = new Worker('worker.js'); | ||
</script> | ||
</html>`, | ||
{'worker.js': 'importScripts("loadingtest.res.js")'}, | ||
); | ||
return runner.loaded.then((window) => { | ||
expect(window.worker.sandbox.loadedFile).toBe(true); | ||
}); | ||
}); | ||
|
||
it('can load worker scripts from Blobs', () => { | ||
const runner = new Runner( | ||
` | ||
<html> | ||
<script> | ||
var blob = new Blob(['self.blobLoaded = true;']); | ||
window.worker = new Worker(URL.createObjectURL(blob)); | ||
</script> | ||
</html>`, | ||
{}, | ||
); | ||
return runner.loaded.then((window) => { | ||
expect(window.worker.sandbox.blobLoaded).toBe(true); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.
a284d2b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cajsksk