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

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

Issue 211383007: Use FilePaths in content::DropData to avoid redundant conversions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang-format 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 "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 const char kFileURL[] = "file:///home/user/file.txt"; 18 const char kFileURL[] = "file:///home/user/file.txt";
18 const char kFileName[] = "/home/user/file.txt"; 19 const char kFileName[] = "/home/user/file.txt";
19 const char kGoogleTitle[] = "Google"; 20 const char kGoogleTitle[] = "Google";
20 const char kGoogleURL[] = "http://www.google.com/"; 21 const char kGoogleURL[] = "http://www.google.com/";
21 22
22 namespace ui { 23 namespace ui {
23 24
24 class OSExchangeDataProviderAuraX11Test : public testing::Test { 25 class OSExchangeDataProviderAuraX11Test : public testing::Test {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 82 }
82 83
83 TEST_F(OSExchangeDataProviderAuraX11Test, URIListWithBoth) { 84 TEST_F(OSExchangeDataProviderAuraX11Test, URIListWithBoth) {
84 AddURLList("file:///home/user/file.txt\nhttp://www.google.com"); 85 AddURLList("file:///home/user/file.txt\nhttp://www.google.com");
85 86
86 EXPECT_TRUE(provider.HasFile()); 87 EXPECT_TRUE(provider.HasFile());
87 EXPECT_TRUE(provider.HasURL(ui::OSExchangeData::CONVERT_FILENAMES)); 88 EXPECT_TRUE(provider.HasURL(ui::OSExchangeData::CONVERT_FILENAMES));
88 EXPECT_TRUE(provider.HasURL(ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES)); 89 EXPECT_TRUE(provider.HasURL(ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES));
89 90
90 // We should only receive the file from GetFilenames(). 91 // We should only receive the file from GetFilenames().
91 std::vector<OSExchangeData::FileInfo> filenames; 92 std::vector<FileInfo> filenames;
92 EXPECT_TRUE(provider.GetFilenames(&filenames)); 93 EXPECT_TRUE(provider.GetFilenames(&filenames));
93 ASSERT_EQ(1u, filenames.size()); 94 ASSERT_EQ(1u, filenames.size());
94 EXPECT_EQ(kFileName, filenames[0].path.value()); 95 EXPECT_EQ(kFileName, filenames[0].path.value());
95 96
96 // We should only receive the URL here. 97 // We should only receive the URL here.
97 GURL out_gurl; 98 GURL out_gurl;
98 base::string16 out_str; 99 base::string16 out_str;
99 EXPECT_TRUE(provider.GetURLAndTitle( 100 EXPECT_TRUE(provider.GetURLAndTitle(
100 OSExchangeData::DO_NOT_CONVERT_FILENAMES, &out_gurl, &out_str)); 101 OSExchangeData::DO_NOT_CONVERT_FILENAMES, &out_gurl, &out_str));
101 EXPECT_EQ(base::string16(), out_str); 102 EXPECT_EQ(base::string16(), out_str);
(...skipping 14 matching lines...) Expand all
116 AddURLList(kFileURL); 117 AddURLList(kFileURL);
117 118
118 EXPECT_FALSE(provider.HasString()); 119 EXPECT_FALSE(provider.HasString());
119 base::string16 out_str; 120 base::string16 out_str;
120 EXPECT_FALSE(provider.GetString(&out_str)); 121 EXPECT_FALSE(provider.GetString(&out_str));
121 122
122 EXPECT_TRUE(provider.HasFile()); 123 EXPECT_TRUE(provider.HasFile());
123 } 124 }
124 125
125 } // namespace ui 126 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698