Home | History | Annotate | Download | only in bookmarks
      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 #include "testing/gtest/include/gtest/gtest.h"
      7 #include "ui/base/dragdrop/gtk_dnd_util.h"
      8 
      9 TEST(BookmarkUtilsGtkTest, GetNodesFromSelectionInvalid) {
     10   std::vector<const BookmarkNode*> nodes;
     11   nodes = bookmark_utils::GetNodesFromSelection(NULL, NULL, 0, NULL, NULL,
     12                                                 NULL);
     13   EXPECT_EQ(0u, nodes.size());
     14 
     15   GtkSelectionData data;
     16   data.data = NULL;
     17   data.length = 0;
     18   nodes = bookmark_utils::GetNodesFromSelection(NULL, &data, 0, NULL, NULL,
     19                                                 NULL);
     20   EXPECT_EQ(0u, nodes.size());
     21 
     22   nodes = bookmark_utils::GetNodesFromSelection(NULL, NULL,
     23       ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL);
     24   EXPECT_EQ(0u, nodes.size());
     25 
     26   data.data = NULL;
     27   data.length = 0;
     28   nodes = bookmark_utils::GetNodesFromSelection(NULL, &data,
     29       ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL);
     30   EXPECT_EQ(0u, nodes.size());
     31 
     32   guchar test_data[] = "";
     33   data.data = test_data;
     34   data.length = 0;
     35   nodes = bookmark_utils::GetNodesFromSelection(NULL, &data,
     36       ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL);
     37   EXPECT_EQ(0u, nodes.size());
     38 }
     39