| Index: third_party/grpc/test/cpp/util/slice_test.cc
|
| diff --git a/third_party/WebKit/Source/platform/LayoutTestSupport.h b/third_party/grpc/test/cpp/util/slice_test.cc
|
| similarity index 61%
|
| copy from third_party/WebKit/Source/platform/LayoutTestSupport.h
|
| copy to third_party/grpc/test/cpp/util/slice_test.cc
|
| index 0906ea082eb32033082bc8e7ed7bef0f6e4a5a98..de7ff031ab8593ecbc63908cc18f60cd9623bac4 100644
|
| --- a/third_party/WebKit/Source/platform/LayoutTestSupport.h
|
| +++ b/third_party/grpc/test/cpp/util/slice_test.cc
|
| @@ -1,5 +1,7 @@
|
| /*
|
| - * Copyright (C) 2012 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,29 +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.
|
| + *
|
| */
|
|
|
| -#ifndef LayoutTestSupport_h
|
| -#define LayoutTestSupport_h
|
| -
|
| -#include "platform/PlatformExport.h"
|
| -#include "wtf/Allocator.h"
|
| -
|
| -namespace blink {
|
| -
|
| -class LayoutTestSupport {
|
| - STATIC_ONLY(LayoutTestSupport);
|
| -public:
|
| - PLATFORM_EXPORT static bool isRunningLayoutTest();
|
| - PLATFORM_EXPORT static void setIsRunningLayoutTest(bool);
|
| - PLATFORM_EXPORT static bool isMockThemeEnabledForTest();
|
| - PLATFORM_EXPORT static void setMockThemeEnabledForTest(bool);
|
| - PLATFORM_EXPORT static bool isFontAntialiasingEnabledForTest();
|
| - PLATFORM_EXPORT static void setFontAntialiasingEnabledForTest(bool);
|
| - PLATFORM_EXPORT static bool alwaysUseComplexTextForTest();
|
| - PLATFORM_EXPORT static void setAlwaysUseComplexTextForTest(bool);
|
| +#include <grpc++/support/slice.h>
|
| +
|
| +#include <grpc/support/slice.h>
|
| +#include <gtest/gtest.h>
|
| +
|
| +namespace grpc {
|
| +namespace {
|
| +
|
| +const char* kContent = "hello xxxxxxxxxxxxxxxxxxxx world";
|
| +
|
| +class SliceTest : public ::testing::Test {
|
| + protected:
|
| + void CheckSlice(const Slice& s, const grpc::string& content) {
|
| + EXPECT_EQ(content.size(), s.size());
|
| + EXPECT_EQ(content,
|
| + grpc::string(reinterpret_cast<const char*>(s.begin()), s.size()));
|
| + }
|
| };
|
|
|
| -} // namespace blink
|
| +TEST_F(SliceTest, Steal) {
|
| + gpr_slice s = gpr_slice_from_copied_string(kContent);
|
| + Slice spp(s, Slice::STEAL_REF);
|
| + CheckSlice(spp, kContent);
|
| +}
|
| +
|
| +TEST_F(SliceTest, Add) {
|
| + gpr_slice s = gpr_slice_from_copied_string(kContent);
|
| + Slice spp(s, Slice::ADD_REF);
|
| + gpr_slice_unref(s);
|
| + CheckSlice(spp, kContent);
|
| +}
|
| +
|
| +TEST_F(SliceTest, Empty) {
|
| + Slice empty_slice;
|
| + CheckSlice(empty_slice, "");
|
| +}
|
| +
|
| +} // namespace
|
| +} // namespace grpc
|
|
|
| -#endif // LayoutTestSupport_h
|
| +int main(int argc, char** argv) {
|
| + ::testing::InitGoogleTest(&argc, argv);
|
| + return RUN_ALL_TESTS();
|
| +}
|
|
|