summaryrefslogtreecommitdiffstats
path: root/base/clipboard_unittest.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-23 17:35:11 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-23 17:35:11 +0000
commitd1bf2aa00c309571470c9b6791b613dea520140e (patch)
tree7d90d8e54cae18db8f39278d90998bc581040aad /base/clipboard_unittest.cc
parent47b994fc2cac49493133da207e69cfe4529d40f0 (diff)
downloadchromium_src-d1bf2aa00c309571470c9b6791b613dea520140e.zip
chromium_src-d1bf2aa00c309571470c9b6791b613dea520140e.tar.gz
chromium_src-d1bf2aa00c309571470c9b6791b613dea520140e.tar.bz2
Simultaneously store multiple formats on the linux clipboard.
Review URL: http://codereview.chromium.org/8038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/clipboard_unittest.cc')
-rw-r--r--base/clipboard_unittest.cc35
1 files changed, 25 insertions, 10 deletions
diff --git a/base/clipboard_unittest.cc b/base/clipboard_unittest.cc
index c035c9c0..066bd3e 100644
--- a/base/clipboard_unittest.cc
+++ b/base/clipboard_unittest.cc
@@ -42,6 +42,21 @@ TEST_F(ClipboardTest, TextTest) {
EXPECT_EQ(WideToUTF8(text), ascii_text);
}
+TEST_F(ClipboardTest, OverwriteTest) {
+ Clipboard clipboard;
+
+ std::wstring text1(L"first string"), text2(L"second string"), text_result;
+
+ clipboard.Clear();
+ clipboard.WriteText(text1);
+ clipboard.WriteText(text2);
+
+ EXPECT_TRUE(clipboard.IsFormatAvailable(
+ Clipboard::GetPlainTextWFormatType()));
+ clipboard.ReadText(&text_result);
+ EXPECT_EQ(text2, text_result);
+}
+
TEST_F(ClipboardTest, HTMLTest) {
Clipboard clipboard;
@@ -61,8 +76,6 @@ TEST_F(ClipboardTest, HTMLTest) {
#endif
}
-// TODO(estade): Port the following tests.
-#if !defined(OS_LINUX)
TEST_F(ClipboardTest, TrickyHTMLTest) {
Clipboard clipboard;
@@ -75,15 +88,15 @@ TEST_F(ClipboardTest, TrickyHTMLTest) {
Clipboard::GetHtmlFormatType()));
clipboard.ReadHTML(&markup_result, &url_result);
EXPECT_EQ(markup, markup_result);
-
-#if defined(OS_MACOSX)
- // TODO(playmobil): It's not clear that the OS X clipboard needs to support
+#if defined(OS_WIN)
+ // TODO(playmobil): It's not clear that non windows clipboards need to support
// this.
-#else
EXPECT_EQ(url, url_result);
#endif
}
+// TODO(estade): Port the following test (decide what target we use for urls)
+#if !defined(OS_LINUX)
TEST_F(ClipboardTest, BookmarkTest) {
Clipboard clipboard;
@@ -98,6 +111,7 @@ TEST_F(ClipboardTest, BookmarkTest) {
EXPECT_EQ(title, title_result);
EXPECT_EQ(url, url_result);
}
+#endif
TEST_F(ClipboardTest, MultiFormatTest) {
Clipboard clipboard;
@@ -118,10 +132,9 @@ TEST_F(ClipboardTest, MultiFormatTest) {
Clipboard::GetPlainTextFormatType()));
clipboard.ReadHTML(&markup_result, &url_result);
EXPECT_EQ(markup, markup_result);
-#if defined(OS_MACOSX)
- // TODO(playmobil): It's not clear that the OS X clipboard needs to support
+#if defined(OS_WIN)
+ // TODO(playmobil): It's not clear that non windows clipboards need to support
// this.
-#else
EXPECT_EQ(url, url_result);
#endif
clipboard.ReadText(&text_result);
@@ -130,6 +143,8 @@ TEST_F(ClipboardTest, MultiFormatTest) {
EXPECT_EQ(WideToUTF8(text), ascii_text);
}
+// TODO(estade): Port the following tests (decide what targets we use for files)
+#if !defined(OS_LINUX)
// Files for this test don't actually need to exist on the file system, just
// don't try to use a non-existent file you've retrieved from the clipboard.
TEST_F(ClipboardTest, FileTest) {
@@ -176,6 +191,7 @@ TEST_F(ClipboardTest, MultipleFilesTest) {
for (size_t i = 0; i < out_files.size(); ++i)
EXPECT_EQ(files[i], out_files[i]);
}
+#endif // !defined(OS_LINUX)
#if defined(OS_WIN) // Windows only tests.
TEST_F(ClipboardTest, HyperlinkTest) {
@@ -224,4 +240,3 @@ TEST_F(ClipboardTest, BitmapTest) {
Clipboard::GetBitmapFormatType()));
}
#endif
-#endif // !defined(OS_LINUX)