Commit 1e9b9a66 authored by Maggie Cai's avatar Maggie Cai Committed by Commit Bot

Revert "Raw Clipboard: Add Linux platform specific test."

This reverts commit b6bd9b54.

Reason for revert: This CL is likely causes the build failure for https://ci.chromium.org/p/chromium/builders/ci/Win7%20Tests%20%281%29/100478 and https://ci.chromium.org/p/chromium/builders/ci/Win%207%20Tests%20x64%20%281%29/64768

Original change's description:
> Raw Clipboard: Add Linux platform specific test.
> 
> Bug: 897289
> Change-Id: I26335e58672e915a452dc6ae04dac6d712ccac6b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090914
> Auto-Submit: Darwin Huang <huangdarwin@chromium.org>
> Commit-Queue: Victor Costan <pwnall@chromium.org>
> Reviewed-by: Victor Costan <pwnall@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#747546}

TBR=pwnall@chromium.org,huangdarwin@chromium.org

Change-Id: Ie15cb8a2f8e9f41b5c392ca25b557a2e34b1ab10
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 897289
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2091097Reviewed-by: default avatarMaggie Cai <mxcai@chromium.org>
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747595}
parent 6b0034c8
......@@ -733,28 +733,17 @@ TYPED_TEST(ClipboardTest, ReadAvailablePlatformSpecificFormatNamesTest) {
#endif
}
// Test that platform-specific functionality works, with a predefined format in
// On X11 Linux, this test uses a simple MIME type, text/plain.
// On Windows, this test uses a pre-defined ANSI format, CF_TEXT, and tests that
// the Windows implicitly converts this to UNICODE as expected.
#if defined(OS_WIN) || defined(USE_X11)
TYPED_TEST(ClipboardTest, PlatformSpecificDataTest) {
const std::string text = "test string";
// Test that a platform-specific write works.
#if defined(OS_WIN)
// Windows pre-defined ANSI text format.
TYPED_TEST(ClipboardTest, WindowsPredefinedFormatWriteDataTest) {
const std::string kFormatString = "CF_TEXT";
// Windows requires an extra '\0' at the end for a raw write.
const std::string kPlatformSpecificText = text + '\0';
#elif defined(USE_X11)
const std::string kFormatString = "text/plain"; // X11 text format
const std::string kPlatformSpecificText = text;
#endif
const std::string text = "test string";
base::span<const uint8_t> text_span(
reinterpret_cast<const uint8_t*>(kPlatformSpecificText.data()),
kPlatformSpecificText.size());
reinterpret_cast<const uint8_t*>(text.data()), text.size() + 1);
{
ScopedClipboardWriter clipboard_writer(ClipboardBuffer::kCopyPaste);
clipboard_writer.WriteData(ASCIIToUTF16(kFormatString),
clipboard_writer.WriteData(UTF8ToUTF16(kFormatString),
mojo_base::BigBuffer(text_span));
}
......@@ -763,38 +752,27 @@ TYPED_TEST(ClipboardTest, PlatformSpecificDataTest) {
ClipboardBuffer::kCopyPaste);
EXPECT_THAT(raw_types, Contains(ASCIIToUTF16(kFormatString)));
#if defined(OS_WIN)
// Only Windows ClipboardFormatType recognizes ANSI formats.
EXPECT_TRUE(this->clipboard().IsFormatAvailable(
ClipboardFormatType::GetPlainTextAType(), ClipboardBuffer::kCopyPaste));
#endif // defined(OS_WIN)
EXPECT_TRUE(this->clipboard().IsFormatAvailable(
ClipboardFormatType::GetPlainTextType(), ClipboardBuffer::kCopyPaste));
// We're testing platform-specific formats, so use PlatformClipboardTest.
// Only ClipboardWin recognizes the Windows-specific CF_TEXT.
std::string test_suite_name = ::testing::UnitTest::GetInstance()
->current_test_info()
->test_suite_name();
if (test_suite_name == std::string("ClipboardTest/PlatformClipboardTest")) {
std::string text_result;
this->clipboard().ReadAsciiText(ClipboardBuffer::kCopyPaste, &text_result);
EXPECT_EQ(text_result, text);
// Note: Windows will automatically convert CF_TEXT to its UNICODE version.
EXPECT_EQ(text, text_result);
// Windows will automatically convert CF_TEXT to its UNICODE version.
EXPECT_TRUE(this->clipboard().IsFormatAvailable(
ClipboardFormatType::GetPlainTextType(), ClipboardBuffer::kCopyPaste));
base::string16 text_result16;
this->clipboard().ReadText(ClipboardBuffer::kCopyPaste, &text_result16);
EXPECT_EQ(text_result16, base::ASCIIToUTF16(text));
std::string platform_specific_result;
this->clipboard().ReadData(ClipboardFormatType::GetType(kFormatString),
&platform_specific_result);
EXPECT_EQ(platform_specific_result, kPlatformSpecificText);
EXPECT_EQ(base::ASCIIToUTF16(text), text_result16);
}
}
#endif // defined(OS_WIN) || defined(USE_X11)
#endif
#if !defined(OS_MACOSX) && !defined(OS_ANDROID)
TYPED_TEST(ClipboardTest, HyperlinkTest) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment