Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Unified Diff: ui/base/clipboard/clipboard_unittest.cc

Issue 8429022: Adjust fragment indices appropriately when pasting HTML on Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/clipboard/clipboard_unittest.cc
diff --git a/ui/base/clipboard/clipboard_unittest.cc b/ui/base/clipboard/clipboard_unittest.cc
index 59252d9304d9336f1aa22a9a9ec08b176d33552d..34483e8719e93ba86c5abad6f9bd3388e0de5107 100644
--- a/ui/base/clipboard/clipboard_unittest.cc
+++ b/ui/base/clipboard/clipboard_unittest.cc
@@ -143,6 +143,33 @@ TEST_F(ClipboardTest, TrickyHTMLTest) {
#endif // defined(OS_WIN)
}
+#if defined(OS_WIN)
+TEST_F(ClipboardTest, UniodeHTMLTest) {
+ Clipboard clipboard;
+
+ string16 markup(UTF8ToUTF16("<div>A \xc3\xb8 \xe6\xb0\xb4</div>")),
+ markup_result;
+ std::string url, url_result;
+
+ {
+ ScopedClipboardWriter clipboard_writer(&clipboard);
+ clipboard_writer.WriteHTML(markup, url);
+ }
+
+ EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(),
+ Clipboard::BUFFER_STANDARD));
+ uint32 fragment_start;
+ uint32 fragment_end;
+ clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &markup_result, &url_result,
+ &fragment_start, &fragment_end);
+ EXPECT_PRED2(MarkupMatches, markup, markup_result);
+ EXPECT_EQ(url, url_result);
+ // Make sure that fragment indices were adjusted when converting.
+ EXPECT_EQ(36, fragment_start);
+ EXPECT_EQ(56, fragment_end);
+}
+#endif // defined(OS_WIN)
+
#if defined(TOOLKIT_USES_GTK)
// Regression test for crbug.com/56298 (pasting empty HTML crashes Linux).
TEST_F(ClipboardTest, EmptyHTMLTest) {
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698