| OLD | NEW |
| 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "app/gtk_dnd_util.h" | |
| 8 #include "base/pickle.h" | 7 #include "base/pickle.h" |
| 9 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 11 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| 13 |
| 14 namespace ui { |
| 13 | 15 |
| 14 TEST(GtkDndUtilTest, ExtractNamedURLValid) { | 16 TEST(GtkDndUtilTest, ExtractNamedURLValid) { |
| 15 const std::string kTitle = "title"; | 17 const std::string kTitle = "title"; |
| 16 const std::string kUrl = "http://www.foobar.com/"; | 18 const std::string kUrl = "http://www.foobar.com/"; |
| 17 Pickle pickle; | 19 Pickle pickle; |
| 18 pickle.WriteString(kTitle); | 20 pickle.WriteString(kTitle); |
| 19 pickle.WriteString(kUrl); | 21 pickle.WriteString(kUrl); |
| 20 | 22 |
| 21 GtkSelectionData data; | 23 GtkSelectionData data; |
| 22 scoped_array<guchar> test_data(new guchar[pickle.size()]); | 24 scoped_array<guchar> test_data(new guchar[pickle.size()]); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 Pickle pickle; | 70 Pickle pickle; |
| 69 pickle.WriteString(kTitle); | 71 pickle.WriteString(kTitle); |
| 70 | 72 |
| 71 scoped_array<guchar> test_data(new guchar[pickle.size()]); | 73 scoped_array<guchar> test_data(new guchar[pickle.size()]); |
| 72 memcpy(test_data.get(), pickle.data(), pickle.size()); | 74 memcpy(test_data.get(), pickle.data(), pickle.size()); |
| 73 data.data = test_data.get(); | 75 data.data = test_data.get(); |
| 74 data.length = pickle.size(); | 76 data.length = pickle.size(); |
| 75 | 77 |
| 76 EXPECT_FALSE(gtk_dnd_util::ExtractNamedURL(&data, &url, &title)); | 78 EXPECT_FALSE(gtk_dnd_util::ExtractNamedURL(&data, &url, &title)); |
| 77 } | 79 } |
| 80 |
| 81 } // namespace ui |
| OLD | NEW |