| Index: third_party/grpc/test/cpp/qps/async_streaming_ping_pong_test.cc
|
| diff --git a/third_party/WebKit/Source/core/css/CSSValueTestHelper.h b/third_party/grpc/test/cpp/qps/async_streaming_ping_pong_test.cc
|
| similarity index 56%
|
| copy from third_party/WebKit/Source/core/css/CSSValueTestHelper.h
|
| copy to third_party/grpc/test/cpp/qps/async_streaming_ping_pong_test.cc
|
| index 39b526a02aa3dde7741ec7470ec055eb426eca16..97499329c1f2193b5b78a6007797b88a216fc402 100644
|
| --- a/third_party/WebKit/Source/core/css/CSSValueTestHelper.h
|
| +++ b/third_party/grpc/test/cpp/qps/async_streaming_ping_pong_test.cc
|
| @@ -1,5 +1,7 @@
|
| /*
|
| - * Copyright (c) 2013, 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,51 +28,51 @@
|
| * 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.
|
| + *
|
| */
|
|
|
| -/**
|
| - * Make testing with gtest and gmock nicer by adding pretty print and other
|
| - * helper functions.
|
| - */
|
| -
|
| -#ifndef CSSValueTestHelper_h
|
| -#define CSSValueTestHelper_h
|
| +#include <set>
|
|
|
| -#include "core/css/CSSPrimitiveValue.h"
|
| -#include "core/css/CSSValue.h"
|
| +#include <grpc/support/log.h>
|
|
|
| -#include <ostream>
|
| +#include "test/cpp/qps/driver.h"
|
| +#include "test/cpp/qps/report.h"
|
| +#include "test/cpp/util/benchmark_config.h"
|
|
|
| +namespace grpc {
|
| namespace testing {
|
| -namespace internal {
|
|
|
| -// gtest tests won't compile with clang when trying to EXPECT_EQ a class that
|
| -// has the "template<typename T> operator T*()" private.
|
| -// (See https://code.google.com/p/googletest/issues/detail?id=442)
|
| -//
|
| -// Work around is to define this custom IsNullLiteralHelper.
|
| -char(&IsNullLiteralHelper(const blink::CSSValue&))[2];
|
| +static const int WARMUP = 5;
|
| +static const int BENCHMARK = 10;
|
|
|
| -}
|
| -} // namespace testing
|
| +static void RunAsyncStreamingPingPong() {
|
| + gpr_log(GPR_INFO, "Running Async Streaming Ping Pong");
|
|
|
| -namespace blink {
|
| + ClientConfig client_config;
|
| + client_config.set_client_type(ASYNC_CLIENT);
|
| + client_config.set_outstanding_rpcs_per_channel(1);
|
| + client_config.set_client_channels(1);
|
| + client_config.set_async_client_threads(1);
|
| + client_config.set_rpc_type(STREAMING);
|
| + client_config.mutable_load_params()->mutable_closed_loop();
|
|
|
| -inline bool operator==(const CSSValue& a, const CSSValue& b)
|
| -{
|
| - return a.equals(b);
|
| -}
|
| + ServerConfig server_config;
|
| + server_config.set_server_type(ASYNC_SERVER);
|
| + server_config.set_async_server_threads(1);
|
|
|
| -inline void PrintTo(const CSSValue& cssValue, ::std::ostream* os, const char* typeName = "CSSValue")
|
| -{
|
| - *os << typeName << "(" << cssValue.cssText().utf8().data() << ")";
|
| -}
|
| + const auto result =
|
| + RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
|
|
|
| -inline void PrintTo(const CSSPrimitiveValue& cssValue, ::std::ostream* os, const char* typeName = "CSSPrimitiveValue")
|
| -{
|
| - PrintTo(static_cast<const CSSValue&>(cssValue), os, typeName);
|
| + GetReporter()->ReportQPS(*result);
|
| + GetReporter()->ReportLatency(*result);
|
| }
|
|
|
| -} // namespace blink
|
| +} // namespace testing
|
| +} // namespace grpc
|
|
|
| -#endif
|
| +int main(int argc, char** argv) {
|
| + grpc::testing::InitBenchmark(&argc, &argv, true);
|
| +
|
| + grpc::testing::RunAsyncStreamingPingPong();
|
| + return 0;
|
| +}
|
|
|