| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/clipboard.h" | 8 #include "base/clipboard.h" |
| 9 #include "base/platform_test.h" | 9 #include "base/platform_test.h" |
| 10 #include "base/scoped_clipboard_writer.h" | 10 #include "base/scoped_clipboard_writer.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 EXPECT_TRUE(clipboard.IsFormatAvailable( | 46 EXPECT_TRUE(clipboard.IsFormatAvailable( |
| 47 Clipboard::GetPlainTextWFormatType())); | 47 Clipboard::GetPlainTextWFormatType())); |
| 48 EXPECT_TRUE(clipboard.IsFormatAvailable( | 48 EXPECT_TRUE(clipboard.IsFormatAvailable( |
| 49 Clipboard::GetPlainTextFormatType())); | 49 Clipboard::GetPlainTextFormatType())); |
| 50 clipboard.ReadText(&text_result); | 50 clipboard.ReadText(&text_result); |
| 51 EXPECT_EQ(text, text_result); | 51 EXPECT_EQ(text, text_result); |
| 52 clipboard.ReadAsciiText(&ascii_text); | 52 clipboard.ReadAsciiText(&ascii_text); |
| 53 EXPECT_EQ(WideToUTF8(text), ascii_text); | 53 EXPECT_EQ(WideToUTF8(text), ascii_text); |
| 54 } | 54 } |
| 55 | 55 |
| 56 TEST_F(ClipboardTest, HTMLTest) { | 56 TEST_F(ClipboardTest, DISABLED_HTMLTest) { |
| 57 Clipboard clipboard; | 57 Clipboard clipboard; |
| 58 | 58 |
| 59 std::wstring markup(L"<string>Hi!</string>"), markup_result; | 59 std::wstring markup(L"<string>Hi!</string>"), markup_result; |
| 60 std::string url("http://www.example.com/"), url_result; | 60 std::string url("http://www.example.com/"), url_result; |
| 61 | 61 |
| 62 { | 62 { |
| 63 ScopedClipboardWriter scw(&clipboard); | 63 ScopedClipboardWriter scw(&clipboard); |
| 64 scw.WriteHTML(markup, url); | 64 scw.WriteHTML(markup, url); |
| 65 } | 65 } |
| 66 | 66 |
| 67 EXPECT_EQ(true, clipboard.IsFormatAvailable( | 67 EXPECT_EQ(true, clipboard.IsFormatAvailable( |
| 68 Clipboard::GetHtmlFormatType())); | 68 Clipboard::GetHtmlFormatType())); |
| 69 clipboard.ReadHTML(&markup_result, &url_result); | 69 clipboard.ReadHTML(&markup_result, &url_result); |
| 70 EXPECT_EQ(markup, markup_result); | 70 EXPECT_EQ(markup, markup_result); |
| 71 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
| 72 // TODO(playmobil): It's not clear that non windows clipboards need to support | 72 // TODO(playmobil): It's not clear that non windows clipboards need to support |
| 73 // this. | 73 // this. |
| 74 EXPECT_EQ(url, url_result); | 74 EXPECT_EQ(url, url_result); |
| 75 #endif | 75 #endif |
| 76 } | 76 } |
| 77 | 77 |
| 78 TEST_F(ClipboardTest, TrickyHTMLTest) { | 78 TEST_F(ClipboardTest, DISABLED_TrickyHTMLTest) { |
| 79 Clipboard clipboard; | 79 Clipboard clipboard; |
| 80 | 80 |
| 81 std::wstring markup(L"<em>Bye!<!--EndFragment --></em>"), markup_result; | 81 std::wstring markup(L"<em>Bye!<!--EndFragment --></em>"), markup_result; |
| 82 std::string url, url_result; | 82 std::string url, url_result; |
| 83 | 83 |
| 84 { | 84 { |
| 85 ScopedClipboardWriter scw(&clipboard); | 85 ScopedClipboardWriter scw(&clipboard); |
| 86 scw.WriteHTML(markup, url); | 86 scw.WriteHTML(markup, url); |
| 87 } | 87 } |
| 88 | 88 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 EXPECT_EQ(true, | 113 EXPECT_EQ(true, |
| 114 clipboard.IsFormatAvailable(Clipboard::GetUrlWFormatType())); | 114 clipboard.IsFormatAvailable(Clipboard::GetUrlWFormatType())); |
| 115 clipboard.ReadBookmark(&title_result, &url_result); | 115 clipboard.ReadBookmark(&title_result, &url_result); |
| 116 EXPECT_EQ(title, title_result); | 116 EXPECT_EQ(title, title_result); |
| 117 EXPECT_EQ(url, url_result); | 117 EXPECT_EQ(url, url_result); |
| 118 } | 118 } |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 TEST_F(ClipboardTest, MultiFormatTest) { | 121 TEST_F(ClipboardTest, DISABLED_MultiFormatTest) { |
| 122 Clipboard clipboard; | 122 Clipboard clipboard; |
| 123 | 123 |
| 124 std::wstring text(L"Hi!"), text_result; | 124 std::wstring text(L"Hi!"), text_result; |
| 125 std::wstring markup(L"<strong>Hi!</string>"), markup_result; | 125 std::wstring markup(L"<strong>Hi!</string>"), markup_result; |
| 126 std::string url("http://www.example.com/"), url_result; | 126 std::string url("http://www.example.com/"), url_result; |
| 127 std::string ascii_text; | 127 std::string ascii_text; |
| 128 | 128 |
| 129 { | 129 { |
| 130 ScopedClipboardWriter scw(&clipboard); | 130 ScopedClipboardWriter scw(&clipboard); |
| 131 scw.WriteHTML(markup, url); | 131 scw.WriteHTML(markup, url); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 { | 258 { |
| 259 ScopedClipboardWriter scw(&clipboard); | 259 ScopedClipboardWriter scw(&clipboard); |
| 260 scw.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4)); | 260 scw.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4)); |
| 261 } | 261 } |
| 262 | 262 |
| 263 EXPECT_EQ(true, clipboard.IsFormatAvailable( | 263 EXPECT_EQ(true, clipboard.IsFormatAvailable( |
| 264 Clipboard::GetBitmapFormatType())); | 264 Clipboard::GetBitmapFormatType())); |
| 265 } | 265 } |
| 266 #endif | 266 #endif |
| OLD | NEW |