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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk_unittest.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
6
7 #include <string>
8
9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/base/dragdrop/gtk_dnd_util.h"
13 #include "url/gurl.h"
14
15 TEST(BookmarkUtilsGtkTest, GetNodesFromSelectionInvalid) {
16 std::vector<const BookmarkNode*> nodes;
17 nodes = GetNodesFromSelection(NULL, NULL, 0, NULL, NULL, NULL);
18 EXPECT_EQ(0u, nodes.size());
19
20 GtkSelectionData data;
21 data.data = NULL;
22 data.length = 0;
23 nodes = GetNodesFromSelection(NULL, &data, 0, NULL, NULL, NULL);
24 EXPECT_EQ(0u, nodes.size());
25
26 nodes = GetNodesFromSelection(
27 NULL, NULL, ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL);
28 EXPECT_EQ(0u, nodes.size());
29
30 data.data = NULL;
31 data.length = 0;
32 nodes = GetNodesFromSelection(
33 NULL, &data, ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL);
34 EXPECT_EQ(0u, nodes.size());
35
36 guchar test_data[] = "";
37 data.data = test_data;
38 data.length = 0;
39 nodes = GetNodesFromSelection(
40 NULL, &data, ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL);
41 EXPECT_EQ(0u, nodes.size());
42 }
43
44 TEST(BookmarkUtilsGtkTest, WriteBookmarkToSelectionHTML) {
45 BookmarkNode x(GURL("http://www.google.com"));
46 x.SetTitle(base::string16(base::ASCIIToUTF16("Google")));
47 GtkSelectionData data;
48 data.data = NULL;
49 data.length = 0;
50 WriteBookmarkToSelection(&x, &data, ui::TEXT_HTML, NULL);
51 std::string selection(reinterpret_cast<char*>(data.data), data.length);
52 EXPECT_EQ("<a href=\"http://www.google.com/\">Google</a>", selection);
53
54 // Free the copied data in GtkSelectionData
55 gtk_selection_data_set(&data, data.type, data.format, NULL, -1);
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698