Index: third_party/grpc/test/cpp/interop/server_helper.cc |
diff --git a/third_party/WebKit/Source/core/css/CSSValueTestHelper.h b/third_party/grpc/test/cpp/interop/server_helper.cc |
similarity index 50% |
copy from third_party/WebKit/Source/core/css/CSSValueTestHelper.h |
copy to third_party/grpc/test/cpp/interop/server_helper.cc |
index 39b526a02aa3dde7741ec7470ec055eb426eca16..9a284094f00c35ed96e3c20d7ef0f528827327da 100644 |
--- a/third_party/WebKit/Source/core/css/CSSValueTestHelper.h |
+++ b/third_party/grpc/test/cpp/interop/server_helper.cc |
@@ -1,5 +1,7 @@ |
/* |
- * Copyright (c) 2013, 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,51 +28,58 @@ |
* 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. |
- */ |
+#include "test/cpp/interop/server_helper.h" |
-#ifndef CSSValueTestHelper_h |
-#define CSSValueTestHelper_h |
+#include <memory> |
-#include "core/css/CSSPrimitiveValue.h" |
-#include "core/css/CSSValue.h" |
+#include <gflags/gflags.h> |
+#include <grpc++/security/server_credentials.h> |
-#include <ostream> |
+#include "src/core/surface/call_test_only.h" |
+#include "test/core/end2end/data/ssl_test_data.h" |
-namespace testing { |
-namespace internal { |
+DECLARE_bool(use_tls); |
-// 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]; |
+namespace grpc { |
+namespace testing { |
+std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() { |
+ if (FLAGS_use_tls) { |
+ SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, |
+ test_server1_cert}; |
+ SslServerCredentialsOptions ssl_opts; |
+ ssl_opts.pem_root_certs = ""; |
+ ssl_opts.pem_key_cert_pairs.push_back(pkcp); |
+ return SslServerCredentials(ssl_opts); |
+ } else { |
+ return InsecureServerCredentials(); |
+ } |
} |
-} // namespace testing |
-namespace blink { |
+InteropServerContextInspector::InteropServerContextInspector( |
+ const ::grpc::ServerContext& context) |
+ : context_(context) {} |
-inline bool operator==(const CSSValue& a, const CSSValue& b) |
-{ |
- return a.equals(b); |
+grpc_compression_algorithm |
+InteropServerContextInspector::GetCallCompressionAlgorithm() const { |
+ return grpc_call_test_only_get_compression_algorithm(context_.call_); |
} |
-inline void PrintTo(const CSSValue& cssValue, ::std::ostream* os, const char* typeName = "CSSValue") |
-{ |
- *os << typeName << "(" << cssValue.cssText().utf8().data() << ")"; |
+uint32_t InteropServerContextInspector::GetEncodingsAcceptedByClient() const { |
+ return grpc_call_test_only_get_encodings_accepted_by_peer(context_.call_); |
} |
-inline void PrintTo(const CSSPrimitiveValue& cssValue, ::std::ostream* os, const char* typeName = "CSSPrimitiveValue") |
-{ |
- PrintTo(static_cast<const CSSValue&>(cssValue), os, typeName); |
+std::shared_ptr<const AuthContext> |
+InteropServerContextInspector::GetAuthContext() const { |
+ return context_.auth_context(); |
} |
-} // namespace blink |
+bool InteropServerContextInspector::IsCancelled() const { |
+ return context_.IsCancelled(); |
+} |
-#endif |
+} // namespace testing |
+} // namespace grpc |