| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
| 6 | 6 |
| 7 // Clean up X11 header polution | 7 // Clean up X11 header polution |
| 8 #undef None | 8 #undef None |
| 9 #undef Bool | 9 #undef Bool |
| 10 | 10 |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/base/dragdrop/file_info.h" | 15 #include "ui/base/dragdrop/file_info.h" |
| 16 #include "ui/base/x/x11_util.h" | |
| 17 #include "ui/events/platform/x11/x11_event_source_glib.h" | 16 #include "ui/events/platform/x11/x11_event_source_glib.h" |
| 17 #include "ui/gfx/x/x11_atom_cache.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 const char kFileURL[] = "file:///home/user/file.txt"; | 20 const char kFileURL[] = "file:///home/user/file.txt"; |
| 21 const char kFileName[] = "/home/user/file.txt"; | 21 const char kFileName[] = "/home/user/file.txt"; |
| 22 const char kGoogleTitle[] = "Google"; | 22 const char kGoogleTitle[] = "Google"; |
| 23 const char kGoogleURL[] = "http://www.google.com/"; | 23 const char kGoogleURL[] = "http://www.google.com/"; |
| 24 | 24 |
| 25 namespace ui { | 25 namespace ui { |
| 26 | 26 |
| 27 class OSExchangeDataProviderAuraX11Test : public testing::Test { | 27 class OSExchangeDataProviderAuraX11Test : public testing::Test { |
| 28 public: | 28 public: |
| 29 OSExchangeDataProviderAuraX11Test() : event_source(gfx::GetXDisplay()) {} | 29 OSExchangeDataProviderAuraX11Test() : event_source(gfx::GetXDisplay()) {} |
| 30 | 30 |
| 31 void AddURLList(const std::string& list_contents) { | 31 void AddURLList(const std::string& list_contents) { |
| 32 std::string contents_copy = list_contents; | 32 std::string contents_copy = list_contents; |
| 33 scoped_refptr<base::RefCountedMemory> mem( | 33 scoped_refptr<base::RefCountedMemory> mem( |
| 34 base::RefCountedString::TakeString(&contents_copy)); | 34 base::RefCountedString::TakeString(&contents_copy)); |
| 35 | 35 |
| 36 provider.format_map_.Insert(GetAtom(ui::Clipboard::kMimeTypeURIList), mem); | 36 provider.format_map_.Insert(gfx::GetAtom(ui::Clipboard::kMimeTypeURIList), |
| 37 mem); |
| 37 } | 38 } |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 base::MessageLoopForUI message_loop; | 41 base::MessageLoopForUI message_loop; |
| 41 X11EventSourceGlib event_source; | 42 X11EventSourceGlib event_source; |
| 42 ui::OSExchangeDataProviderAuraX11 provider; | 43 ui::OSExchangeDataProviderAuraX11 provider; |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 TEST_F(OSExchangeDataProviderAuraX11Test, MozillaURL) { | 46 TEST_F(OSExchangeDataProviderAuraX11Test, MozillaURL) { |
| 46 // Check that we can get titled entries. | 47 // Check that we can get titled entries. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 AddURLList(kFileURL); | 119 AddURLList(kFileURL); |
| 119 | 120 |
| 120 EXPECT_FALSE(provider.HasString()); | 121 EXPECT_FALSE(provider.HasString()); |
| 121 base::string16 out_str; | 122 base::string16 out_str; |
| 122 EXPECT_FALSE(provider.GetString(&out_str)); | 123 EXPECT_FALSE(provider.GetString(&out_str)); |
| 123 | 124 |
| 124 EXPECT_TRUE(provider.HasFile()); | 125 EXPECT_TRUE(provider.HasFile()); |
| 125 } | 126 } |
| 126 | 127 |
| 127 } // namespace ui | 128 } // namespace ui |
| OLD | NEW |