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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc

Issue 219743002: x11: Move X event handling out of the message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r261267 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
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/events/platform/x11/x11_event_source.h"
16 #include "url/gurl.h" 17 #include "url/gurl.h"
17 18
18 const char kFileURL[] = "file:///home/user/file.txt"; 19 const char kFileURL[] = "file:///home/user/file.txt";
19 const char kFileName[] = "/home/user/file.txt"; 20 const char kFileName[] = "/home/user/file.txt";
20 const char kGoogleTitle[] = "Google"; 21 const char kGoogleTitle[] = "Google";
21 const char kGoogleURL[] = "http://www.google.com/"; 22 const char kGoogleURL[] = "http://www.google.com/";
22 23
23 namespace ui { 24 namespace ui {
24 25
25 class OSExchangeDataProviderAuraX11Test : public testing::Test { 26 class OSExchangeDataProviderAuraX11Test : public testing::Test {
26 public: 27 public:
27 OSExchangeDataProviderAuraX11Test() {} 28 OSExchangeDataProviderAuraX11Test() : event_source(gfx::GetXDisplay()) {}
28 29
29 void AddURLList(const std::string& list_contents) { 30 void AddURLList(const std::string& list_contents) {
30 std::string contents_copy = list_contents; 31 std::string contents_copy = list_contents;
31 scoped_refptr<base::RefCountedMemory> mem( 32 scoped_refptr<base::RefCountedMemory> mem(
32 base::RefCountedString::TakeString(&contents_copy)); 33 base::RefCountedString::TakeString(&contents_copy));
33 34
34 provider.format_map_.Insert( 35 provider.format_map_.Insert(
35 provider.atom_cache_.GetAtom(ui::Clipboard::kMimeTypeURIList), 36 provider.atom_cache_.GetAtom(ui::Clipboard::kMimeTypeURIList),
36 mem); 37 mem);
37 } 38 }
38 39
39 protected: 40 protected:
40 base::MessageLoopForUI message_loop; 41 base::MessageLoopForUI message_loop;
42 X11EventSource event_source;
41 ui::OSExchangeDataProviderAuraX11 provider; 43 ui::OSExchangeDataProviderAuraX11 provider;
42 }; 44 };
43 45
44 TEST_F(OSExchangeDataProviderAuraX11Test, MozillaURL) { 46 TEST_F(OSExchangeDataProviderAuraX11Test, MozillaURL) {
45 // Check that we can get titled entries. 47 // Check that we can get titled entries.
46 provider.SetURL(GURL(kGoogleURL), base::ASCIIToUTF16(kGoogleTitle)); 48 provider.SetURL(GURL(kGoogleURL), base::ASCIIToUTF16(kGoogleTitle));
47 { 49 {
48 GURL out_gurl; 50 GURL out_gurl;
49 base::string16 out_str; 51 base::string16 out_str;
50 EXPECT_TRUE(provider.GetURLAndTitle( 52 EXPECT_TRUE(provider.GetURLAndTitle(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 AddURLList(kFileURL); 119 AddURLList(kFileURL);
118 120
119 EXPECT_FALSE(provider.HasString()); 121 EXPECT_FALSE(provider.HasString());
120 base::string16 out_str; 122 base::string16 out_str;
121 EXPECT_FALSE(provider.GetString(&out_str)); 123 EXPECT_FALSE(provider.GetString(&out_str));
122 124
123 EXPECT_TRUE(provider.HasFile()); 125 EXPECT_TRUE(provider.HasFile());
124 } 126 }
125 127
126 } // namespace ui 128 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/dragdrop/os_exchange_data_provider_aurax11.cc ('k') | ui/base/dragdrop/os_exchange_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698