aboutsummaryrefslogtreecommitdiff
path: root/tests/worker_api_2_worker.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-10-22 16:26:30 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-10-22 16:26:30 -0700
commit97f9f26f4bebc8db98608df6e7bcf45322ee189b (patch)
tree2ff62b9b5e3e4c4d97a97caa17ba5ccc77eec294 /tests/worker_api_2_worker.cpp
parentc11c08094b855e8d6d00d84cbea0f4bf2b18ff72 (diff)
handle no-data worker api calls, and more tests
Diffstat (limited to 'tests/worker_api_2_worker.cpp')
-rw-r--r--tests/worker_api_2_worker.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/worker_api_2_worker.cpp b/tests/worker_api_2_worker.cpp
index 6db704a5..d7033bc4 100644
--- a/tests/worker_api_2_worker.cpp
+++ b/tests/worker_api_2_worker.cpp
@@ -8,13 +8,17 @@ struct Info {
double d;
};
+int calls = 0; // global state that is not in all workers
+
extern "C" {
void one(char *data, int size) {
+ calls++;
emscripten_worker_respond(data, size);
}
void two(char *data, int size) {
+ calls++;
Info *x = (Info*)data;
x[0].i++;
x[0].f--;
@@ -23,5 +27,18 @@ void two(char *data, int size) {
emscripten_worker_respond(data, size);
}
+void three(char *data, int size) {
+ assert(data == 0);
+ assert(size == 0);
+ calls++;
+ // no response
+}
+
+void four(char *data, int size) {
+ assert(data == 0);
+ assert(size == 0);
+ emscripten_worker_respond((char*)&calls, sizeof(calls));
+}
+
}