blob: 08ee949f742eacf9557d10d88d311294825fc7b9 [file] [log] [blame]
// Copyright (c) 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/base/clipboard/clipboard_non_backed.h"
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard_data.h"
namespace ui {
class ClipboardNonBackedTest : public testing::Test {
ClipboardNonBackedTest() = default;
ClipboardNonBackedTest(const ClipboardNonBackedTest&) = delete;
ClipboardNonBackedTest& operator=(const ClipboardNonBackedTest&) = delete;
~ClipboardNonBackedTest() override = default;
ClipboardNonBacked* clipboard() { return &clipboard_; }
ClipboardNonBacked clipboard_;
// Verifies that GetClipboardData() returns the same instance of ClipboardData
// as was written via WriteClipboardData().
TEST_F(ClipboardNonBackedTest, WriteAndGetClipboardData) {
auto clipboard_data = std::make_unique<ClipboardData>();
auto* expected_clipboard_data_ptr = clipboard_data.get();
auto* actual_clipboard_data_ptr = clipboard()->GetClipboardData();
EXPECT_EQ(expected_clipboard_data_ptr, actual_clipboard_data_ptr);
} // namespace ui