Index: third_party/grpc/test/core/surface/server_chttp2_test.c |
diff --git a/third_party/WebKit/Source/core/timing/MemoryInfoTest.cpp b/third_party/grpc/test/core/surface/server_chttp2_test.c |
similarity index 51% |
copy from third_party/WebKit/Source/core/timing/MemoryInfoTest.cpp |
copy to third_party/grpc/test/core/surface/server_chttp2_test.c |
index 431dc2ae9fdb007de45a4d841229e48827692d54..84b345bb504cfb99ff647c6cc8b0be102cf4a59b 100644 |
--- a/third_party/WebKit/Source/core/timing/MemoryInfoTest.cpp |
+++ b/third_party/grpc/test/core/surface/server_chttp2_test.c |
@@ -1,5 +1,7 @@ |
/* |
- * Copyright (C) 2012 Google Inc. All rights reserved. |
+ * |
+ * Copyright 2015-2016, 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,32 +28,50 @@ |
* 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 "core/timing/MemoryInfo.h" |
+#include <grpc/grpc.h> |
+#include <grpc/grpc_security.h> |
+#include <grpc/support/alloc.h> |
+#include <grpc/support/host_port.h> |
+#include <grpc/support/log.h> |
+#include <grpc/support/time.h> |
+#include "src/core/security/credentials.h" |
+#include "src/core/tsi/fake_transport_security.h" |
+#include "test/core/util/port.h" |
+#include "test/core/util/test_config.h" |
-#include "testing/gtest/include/gtest/gtest.h" |
+void test_unparsable_target(void) { |
+ int port = grpc_server_add_insecure_http2_port(NULL, "["); |
+ GPR_ASSERT(port == 0); |
+} |
-namespace blink { |
+void test_add_same_port_twice() { |
+ int port = grpc_pick_unused_port_or_die(); |
+ char *addr = NULL; |
+ grpc_completion_queue *cq = grpc_completion_queue_create(NULL); |
+ grpc_server *server = grpc_server_create(NULL, NULL); |
+ grpc_server_credentials *fake_creds = |
+ grpc_fake_transport_security_server_credentials_create(); |
+ gpr_join_host_port(&addr, "localhost", port); |
+ GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, fake_creds)); |
+ GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, fake_creds) == 0); |
-TEST(MemoryInfo, quantizeMemorySize) |
-{ |
- EXPECT_EQ(10000000u, quantizeMemorySize(1024)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(1024 * 1024)); |
- EXPECT_EQ(410000000u, quantizeMemorySize(389472983)); |
- EXPECT_EQ(39600000u, quantizeMemorySize(38947298)); |
- EXPECT_EQ(29400000u, quantizeMemorySize(28947298)); |
- EXPECT_EQ(19300000u, quantizeMemorySize(18947298)); |
- EXPECT_EQ(14300000u, quantizeMemorySize(13947298)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(3894729)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(389472)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(38947)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(3894)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(389)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(38)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(3)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(1)); |
- EXPECT_EQ(10000000u, quantizeMemorySize(0)); |
+ grpc_server_credentials_release(fake_creds); |
+ gpr_free(addr); |
+ grpc_server_shutdown_and_notify(server, cq, NULL); |
+ grpc_completion_queue_pluck(cq, NULL, gpr_inf_future(GPR_CLOCK_REALTIME), |
+ NULL); |
+ grpc_server_destroy(server); |
+ grpc_completion_queue_destroy(cq); |
} |
-} // namespace blink |
+int main(int argc, char **argv) { |
+ grpc_test_init(argc, argv); |
+ grpc_init(); |
+ test_unparsable_target(); |
+ test_add_same_port_twice(); |
+ grpc_shutdown(); |
+ return 0; |
+} |