Commit 1994b275 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Make test clibpoard treat text as url format, on Linux.

This matches the behaviour of ClipboardAuraX11, which
allows OmniboxViewViewsClipboardTest to use the test clipboard.

Bug: 963112
Change-Id: I59cdc24bb7ecd2bd904505e38df133b31ed48104
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1630012Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663968}
parent 177ec176
......@@ -615,13 +615,6 @@ class OmniboxViewViewsClipboardTest
};
TEST_P(OmniboxViewViewsClipboardTest, ClipboardCopyOrCutURL) {
// TODO(crbug.com/396477) Make this an interactive ui test so there isn't
// contention for the system clipboard.
// Force use of the system clipboard because this test checks for URL format
// on Linux, which is not supported by test clipboard.
ui::Clipboard::DestroyClipboardForCurrentThread();
ui::Clipboard::GetForCurrentThread();
omnibox_view()->SelectAll(false);
ASSERT_TRUE(omnibox_view()->IsSelectAll());
......
......@@ -8,6 +8,7 @@
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "skia/ext/skia_utils_base.h"
#include "ui/base/clipboard/clipboard_constants.h"
#include "ui/base/clipboard/clipboard_monitor.h"
......@@ -39,6 +40,12 @@ uint64_t TestClipboard::GetSequenceNumber(ClipboardType type) const {
bool TestClipboard::IsFormatAvailable(const ClipboardFormatType& format,
ClipboardType type) const {
#if defined(OS_LINUX)
// The linux clipboard treats the presence of text on the clipboard
// as the url format being available.
if (format.Equals(ClipboardFormatType::GetUrlType()))
return IsFormatAvailable(ClipboardFormatType::GetPlainTextType(), type);
#endif // OS_LINUX
const DataStore& store = GetStore(type);
return store.data.find(format) != store.data.end();
}
......
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