| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 guchar test_data[] = ""; | 36 guchar test_data[] = ""; |
| 37 data.data = test_data; | 37 data.data = test_data; |
| 38 data.length = 0; | 38 data.length = 0; |
| 39 nodes = GetNodesFromSelection( | 39 nodes = GetNodesFromSelection( |
| 40 NULL, &data, ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); | 40 NULL, &data, ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); |
| 41 EXPECT_EQ(0u, nodes.size()); | 41 EXPECT_EQ(0u, nodes.size()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 TEST(BookmarkUtilsGtkTest, WriteBookmarkToSelectionHTML) { | 44 TEST(BookmarkUtilsGtkTest, WriteBookmarkToSelectionHTML) { |
| 45 BookmarkNode x(GURL("http://www.google.com")); | 45 BookmarkNode x(GURL("http://www.google.com")); |
| 46 x.SetTitle(base::string16(ASCIIToUTF16("Google"))); | 46 x.SetTitle(base::string16(base::ASCIIToUTF16("Google"))); |
| 47 GtkSelectionData data; | 47 GtkSelectionData data; |
| 48 data.data = NULL; | 48 data.data = NULL; |
| 49 data.length = 0; | 49 data.length = 0; |
| 50 WriteBookmarkToSelection(&x, &data, ui::TEXT_HTML, NULL); | 50 WriteBookmarkToSelection(&x, &data, ui::TEXT_HTML, NULL); |
| 51 std::string selection(reinterpret_cast<char*>(data.data), data.length); | 51 std::string selection(reinterpret_cast<char*>(data.data), data.length); |
| 52 EXPECT_EQ("<a href=\"http://www.google.com/\">Google</a>", selection); | 52 EXPECT_EQ("<a href=\"http://www.google.com/\">Google</a>", selection); |
| 53 | 53 |
| 54 // Free the copied data in GtkSelectionData | 54 // Free the copied data in GtkSelectionData |
| 55 gtk_selection_data_set(&data, data.type, data.format, NULL, -1); | 55 gtk_selection_data_set(&data, data.type, data.format, NULL, -1); |
| 56 } | 56 } |
| OLD | NEW |