Index: third_party/grpc/src/core/client_config/client_config.c |
diff --git a/third_party/WebKit/Source/platform/heap/RunAllTests.cpp b/third_party/grpc/src/core/client_config/client_config.c |
similarity index 59% |
copy from third_party/WebKit/Source/platform/heap/RunAllTests.cpp |
copy to third_party/grpc/src/core/client_config/client_config.c |
index 3fceabe1265ad56afa6a19a01f4937ed038e0667..6ecffb3854144e9d87a09e0d67585f8771b910e2 100644 |
--- a/third_party/WebKit/Source/platform/heap/RunAllTests.cpp |
+++ b/third_party/grpc/src/core/client_config/client_config.c |
@@ -1,5 +1,7 @@ |
/* |
- * Copyright (C) 2014 Google Inc. All rights reserved. |
+ * |
+ * Copyright 2015, Google Inc. |
+ * All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -26,40 +28,45 @@ |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ * |
*/ |
-#include "platform/EventTracer.h" |
-#include "platform/heap/Heap.h" |
-#include <base/bind.h> |
-#include <base/test/launcher/unit_test_launcher.h> |
-#include <base/test/test_suite.h> |
-#include <base/time/time.h> |
-#include <content/test/blink_test_environment.h> |
+#include "src/core/client_config/client_config.h" |
+ |
#include <string.h> |
-class BlinkTestEnvironmentScope { |
-public: |
- BlinkTestEnvironmentScope() |
- { |
- content::SetUpBlinkTestEnvironment(); |
- } |
- ~BlinkTestEnvironmentScope() |
- { |
- content::TearDownBlinkTestEnvironment(); |
- } |
+#include <grpc/support/alloc.h> |
+ |
+struct grpc_client_config { |
+ gpr_refcount refs; |
+ grpc_lb_policy *lb_policy; |
}; |
-int runHelper(base::TestSuite* testSuite) |
-{ |
- BlinkTestEnvironmentScope blinkTestEnvironment; |
- blink::ThreadState::current()->registerTraceDOMWrappers(0, 0); |
- int result = testSuite->Run(); |
- blink::ThreadHeap::collectAllGarbage(); |
- return result; |
+grpc_client_config *grpc_client_config_create() { |
+ grpc_client_config *c = gpr_malloc(sizeof(*c)); |
+ memset(c, 0, sizeof(*c)); |
+ gpr_ref_init(&c->refs, 1); |
+ return c; |
+} |
+ |
+void grpc_client_config_ref(grpc_client_config *c) { gpr_ref(&c->refs); } |
+ |
+void grpc_client_config_unref(grpc_exec_ctx *exec_ctx, grpc_client_config *c) { |
+ if (gpr_unref(&c->refs)) { |
+ GRPC_LB_POLICY_UNREF(exec_ctx, c->lb_policy, "client_config"); |
+ gpr_free(c); |
+ } |
+} |
+ |
+void grpc_client_config_set_lb_policy(grpc_client_config *c, |
+ grpc_lb_policy *lb_policy) { |
+ GPR_ASSERT(c->lb_policy == NULL); |
+ if (lb_policy) { |
+ GRPC_LB_POLICY_REF(lb_policy, "client_config"); |
+ } |
+ c->lb_policy = lb_policy; |
} |
-int main(int argc, char** argv) |
-{ |
- base::TestSuite testSuite(argc, argv); |
- return base::LaunchUnitTests(argc, argv, base::Bind(runHelper, base::Unretained(&testSuite))); |
+grpc_lb_policy *grpc_client_config_get_lb_policy(grpc_client_config *c) { |
+ return c->lb_policy; |
} |