Fixed end to end tests

This commit is contained in:
murgatroid99 2015-02-11 16:19:55 -08:00
parent 5bbb836abb
commit d35c92d473
5 changed files with 13 additions and 9 deletions

View File

@ -98,6 +98,9 @@ bool CreateMetadataArray(
string_handles->push_back(unique_ptr<NanUtf8String>(utf8_key));
Handle<Array> values = Local<Array>::Cast(metadata->Get(current_key));
for (unsigned int j = 0; j < values->Length(); j++) {
if (array->count >= array->capacity) {
gpr_log(GPR_ERROR, "Metadata array grew past capacity");
}
Handle<Value> value = values->Get(j);
grpc_metadata *current = &array->metadata[array->count];
current->key = **utf8_key;
@ -433,9 +436,9 @@ Handle<Value> GetTagNodeValue(void *tag) {
return NanEscapeScope(tag_obj);
}
NanCallback GetTagCallback(void *tag) {
NanCallback *GetTagCallback(void *tag) {
struct tag *tag_struct = reinterpret_cast<struct tag *>(tag);
return *tag_struct->callback;
return tag_struct->callback;
}
void DestroyTag(void *tag) {
@ -598,6 +601,7 @@ NAN_METHOD(Call::StartBatch) {
grpc_call_error error = grpc_call_start_batch(
call->wrapped_call, ops, nops, new struct tag(
callback, op_vector, handles, strings));
delete ops;
if (error != GRPC_CALL_OK) {
return NanThrowError("startBatch failed", error);
}

View File

@ -89,7 +89,7 @@ struct tag {
v8::Handle<v8::Value> GetTagNodeValue(void *tag);
NanCallback GetTagCallback(void *tag);
NanCallback *GetTagCallback(void *tag);
void DestroyTag(void *tag);

View File

@ -80,10 +80,10 @@ void CompletionQueueAsyncWorker::Init(Handle<Object> exports) {
void CompletionQueueAsyncWorker::HandleOKCallback() {
NanScope();
gpr_log(GPR_DEBUG, "Handling response on call %p", result->call);
NanCallback callback = GetTagCallback(result->tag);
NanCallback *callback = GetTagCallback(result->tag);
Handle<Value> argv[] = {NanNull(), GetTagNodeValue(result->tag)};
callback.Call(2, argv);
callback->Call(2, argv);
DestroyTag(result->tag);
grpc_event_finish(result);
@ -92,10 +92,10 @@ void CompletionQueueAsyncWorker::HandleOKCallback() {
void CompletionQueueAsyncWorker::HandleErrorCallback() {
NanScope();
NanCallback callback = GetTagCallback(result->tag);
NanCallback *callback = GetTagCallback(result->tag);
Handle<Value> argv[] = {NanError(ErrorMessage())};
callback.Call(1, argv);
callback->Call(1, argv);
DestroyTag(result->tag);
grpc_event_finish(result);

View File

@ -1,6 +1,6 @@
/*
*
* Copyright 2014, Google Inc.
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -67,7 +67,7 @@ describe('end-to-end', function() {
after(function() {
server.shutdown();
});
it.skip('should start and end a request without error', function(complete) {
it('should start and end a request without error', function(complete) {
var done = multiDone(complete, 2);
var deadline = new Date();
deadline.setSeconds(deadline.getSeconds() + 3);