Index: chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk_unittest.cc |
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk_unittest.cc |
index fa790fcef813fa7293e20f906a2f335e064e2988..af4159a1c2bd0bd956f1298a324fb3894ffd6cf1 100644 |
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk_unittest.cc |
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk_unittest.cc |
@@ -2,7 +2,11 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include <string> |
+#include "base/utf_string_conversions.h" |
+#include "chrome/browser/bookmarks/bookmark_model.h" |
#include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
+#include "googleurl/src/gurl.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "ui/base/dragdrop/gtk_dnd_util.h" |
@@ -36,3 +40,17 @@ TEST(BookmarkUtilsGtkTest, GetNodesFromSelectionInvalid) { |
ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); |
EXPECT_EQ(0u, nodes.size()); |
} |
+ |
+TEST(BookmarkUtilsGtkTest, WriteBookmarkToSelectionHTML) { |
+ BookmarkNode x(GURL("http://www.google.com")); |
+ x.set_title(string16(ASCIIToUTF16("Google"))); |
+ GtkSelectionData data; |
+ data.data = NULL; |
+ data.length = 0; |
+ bookmark_utils::WriteBookmarkToSelection(&x, &data, ui::TEXT_HTML, NULL); |
+ std::string selection(reinterpret_cast<char*>(data.data), data.length); |
+ EXPECT_EQ("<a href=\"http://www.google.com/\">Google</a>", selection); |
+ |
+ // Free the copied data in GtkSelectionData |
+ gtk_selection_data_set(&data, data.type, data.format, NULL, -1); |
+} |