Commit Graph

586 Commits (6821b789a4b43f1ac6b9fb929e636f5310079ad8)

Author SHA1 Message Date
Daniel Reichert 6125f7cbbb Add basic test coverage of toArrayBuffer function 11 years ago
lilia b9859ad9d4 Add some license headers 11 years ago
lilia 28290477f4 Nicer timestamps with momentjs
This dependency may be a little heavy for our current use case, but we can
roll with it for now and find something slimmer if it turns out yagni.

Closes #77
Closes #40
11 years ago
lilia 18378d8097 Fold nacl-common into components 11 years ago
lilia db69bacff1 Do fewer string conversions in tests 11 years ago
lilia e190582d9e Build CryptoJS components into webcrypto.js
We only depend on cryptojs for this webcrypto polyfill, so let Grunt
concatenate them into one file.

The reference in the getString helper isn't needed since we use the
built in string converters on CryptoJS's word arrays.
11 years ago
lilia 4518d03f43 Move protocol test to end of suite and extend timeout
The keygen test works without native client, but it takes a loooooong
tiiiiiiime.
11 years ago
lilia 2f58ea5f3a Fixup curve25519 module
Rename methods on the curve25519 interface to be a bit more high level.
Cleanup emscripten wrapper class, wrap long lines and such. Also add a
grunt task alias for building the emscripten compiled curve
implementation.
11 years ago
lilia a1a528ccdd Finish abstracting native client
Firstly, don't initialize textsecure.nativclient unless the browser
supports it. The mimetype-check trick is hewn from nacl-common.js.

Secondly, nativeclient crypto functions will all automatically wait for
the module to load before sending messages, so we needn't register any
onload callbacks outside nativeclient.js. (Previously, if you wanted to
do crypto with native client, you would have to register a call back and
wait for the module to load.) Now that the native client crypto is
encapsulated behind a nice interface, it can handle all that
onload-callback jazz internally: if the module isn't loaded when you
call a nativeclient function, return a promise that waits for the load
callback, and eventually resolves with the result of the requested
command. This removes the need for textsecure.registerOnLoadCallback.

Finally, although native client has its quirks, it's significantly
faster than the alternative (emscripten compiled js), so this commit
also lets the crypto backend use native client opportunistically, if
it's available, falling back to js if not, which should make us
compatible with older versions of chrome and chromium.
11 years ago
lilia 30dd43a959 Remove stray debugging test 11 years ago
lilia b4f4f87a7c Add emscripten-compiled curve25519 module
Build with `grunt compile && grunt concat:curve25519` after installing
emscripten.

Enable by either (a) not loading nativeclient.js or (b) setting
`textsecure.NATIVE_CLIENT = false` before loading nativeclient.js.
11 years ago
lilia 3d27c98845 Remove stray curve25519.js include 11 years ago
lilia 7c25ff845b Simplify a test
Protobufs are loaded already
11 years ago
lilia 69c52d51b3 Abstract out curve25519 tests
Also rename the internal variable in crypto.js to be a little more
explicit about which curve we're dealing with.
11 years ago
lilia df0e52a893 Split crypto_test into crypto, protocol and helpers tests 11 years ago
lilia 9f676af9bb Refactor crypto.js and native client interface
NB: this diff is best viewed with --ignore-whitespace

Distills crypto.js down to the hard cryptoey bones. It pulls from
webcrypto for aes and hmac, and from native client for curve25519 stuff
or potentially another object implementing the handful of needed
curve25519 functions.

Everything else formerly known as crypto, including session storage and
management, axolotl, etc.. is now protocol.js. The separation is not
quite perfect, but it's a big step.

nativeclient.js now enables talking to the native client module through
a high level interface as well as registering callbacks that will be
executed once the module is loaded. And it has tests!

Finally, this commit removes all references to the "testing_only"
object, preferring to run tests on textsecure.crypto instead.
11 years ago
lilia f7d92ccb5b Bowerize backbone.localstorage 11 years ago
lilia 6e86a2b7cf Switch libphonenumber to bower 11 years ago
lilia 6b034e951a Make the concat list explicit
Since I decided to preen mocha and chai, we can no longer generate the
concat file list from the preen config. We must instead explicitly list
the modules we want to concatenate. I placed this config in bower.json
so that most of the time, we won't need to change the Gruntfile.

Also added a concatenation task for test page dependencies.
11 years ago
lilia 508c59e05c Rename bower_components
To components. Because tab-completion works better when there aren't two
things starting with bower, and shorter names are nicer to deal with in
general.
11 years ago
lilia 6e739a8a77 Add mustache to bower 11 years ago
lilia b351e8cea0 Switch mocha and chai to bower components 11 years ago
lilia 73f4f64351 Grunt preen and concat
Set up grunt with tasks for:
  * preen - deletes unused files from bower_components, configured in
      bower.json
  * concat - concatenates preened bower components, configured
      automagically from the preen config

It's worth noting that this setup assumes the order of files within a
package doesn't matter. This is usually true since we often include only
one file from the package.
11 years ago
lilia c8ad65efe0 Switch to bower dependencies
Checks in only the files we actually need from bower_components.
11 years ago
lilia df0eaf622a Clean up test files
Moved all test code into /test. Renamed test.js to crypto_test.js.
(Let's try to keep test files topical.) Merged test_views.html and
test.html into a single test/index.html.

Todo: use Grunt to generate test/index.html from index.html and files
found in /test. Also, write more tests.
11 years ago
lilia 245dc5b248 Update message view test 11 years ago
lilia cb89ac1071 Fix view test nacl path 11 years ago
lilia 1c76c0b546 Move storage objects to their own files
Greatly reduce the size of the ignominiously named helpers.js.
11 years ago
Arnaud Benard e568e2c528 Fixes #61 - Order by timestamps with tests 11 years ago
lilia 0cf5ae3bbf Reorganize message view test a bit 11 years ago
lilia db86abdf70 Add list view tests
Also,
 * moved fetch out of the list view
 * removed unused #last() function
 * put test setup lines in their own tiny file.
 * added data-cover to view script tags for code coveage reports.
11 years ago
lilia 4ccb2b2f98 Add a page for testing views. 11 years ago
Matt Corallo 87b626d42a Fix blanket popup 11 years ago
Matt Corallo 615fa1075c Fix blanket for plugin (http://stackoverflow.com/questions/23022686) 11 years ago
Matt Corallo 5e3b7e9db8 Add missing blanket-js file 11 years ago
lilia 2751d0e884 Such tests. Very mocha. Much chai. Amaze!!!
ERHMAGERRRD testing frameworks are so the best. Removed all our custom
code for ensuring test exclusivity and doneness and isolating callbacks
and everything. mocha does it all for us, and makes it pretty.

Also rather than return a long chain of promises that eventually resolve
to truthiness, we now use chai to make assertions about what is good and
right in the world.

Recommended reading:
  https://visionmedia.github.io/mocha
  http://chaijs.com/api/assert/
11 years ago