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

Side by Side Diff: base/clipboard_unittest.cc

Issue 118469: compile on openbsd: mostly ifdefs and missing includes,... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/clipboard.h" 8 #include "base/clipboard.h"
9 #include "base/gfx/size.h" 9 #include "base/gfx/size.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 clipboard.ReadHTML(&markup_result, &url_result); 109 clipboard.ReadHTML(&markup_result, &url_result);
110 EXPECT_EQ(markup, markup_result); 110 EXPECT_EQ(markup, markup_result);
111 #if defined(OS_WIN) 111 #if defined(OS_WIN)
112 // TODO(playmobil): It's not clear that non windows clipboards need to support 112 // TODO(playmobil): It's not clear that non windows clipboards need to support
113 // this. 113 // this.
114 EXPECT_EQ(url, url_result); 114 EXPECT_EQ(url, url_result);
115 #endif // defined(OS_WIN) 115 #endif // defined(OS_WIN)
116 } 116 }
117 117
118 // TODO(estade): Port the following test (decide what target we use for urls) 118 // TODO(estade): Port the following test (decide what target we use for urls)
119 #if !defined(OS_LINUX) 119 #if !defined(OS_LINUX) && !defined(OS_OPENBSD)
120 TEST_F(ClipboardTest, BookmarkTest) { 120 TEST_F(ClipboardTest, BookmarkTest) {
121 Clipboard clipboard; 121 Clipboard clipboard;
122 122
123 string16 title(ASCIIToUTF16("The Example Company")), title_result; 123 string16 title(ASCIIToUTF16("The Example Company")), title_result;
124 std::string url("http://www.example.com/"), url_result; 124 std::string url("http://www.example.com/"), url_result;
125 125
126 { 126 {
127 ScopedClipboardWriter clipboard_writer(&clipboard); 127 ScopedClipboardWriter clipboard_writer(&clipboard);
128 clipboard_writer.WriteBookmark(title, url); 128 clipboard_writer.WriteBookmark(title, url);
129 } 129 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // this. 163 // this.
164 EXPECT_EQ(url, url_result); 164 EXPECT_EQ(url, url_result);
165 #endif // defined(OS_WIN) 165 #endif // defined(OS_WIN)
166 clipboard.ReadText(&text_result); 166 clipboard.ReadText(&text_result);
167 EXPECT_EQ(text, text_result); 167 EXPECT_EQ(text, text_result);
168 clipboard.ReadAsciiText(&ascii_text); 168 clipboard.ReadAsciiText(&ascii_text);
169 EXPECT_EQ(UTF16ToUTF8(text), ascii_text); 169 EXPECT_EQ(UTF16ToUTF8(text), ascii_text);
170 } 170 }
171 171
172 // TODO(estade): Port the following tests (decide what targets we use for files) 172 // TODO(estade): Port the following tests (decide what targets we use for files)
173 #if !defined(OS_LINUX) 173 #if !defined(OS_LINUX) && !defined(OS_OPENBSD)
174 // Files for this test don't actually need to exist on the file system, just 174 // Files for this test don't actually need to exist on the file system, just
175 // don't try to use a non-existent file you've retrieved from the clipboard. 175 // don't try to use a non-existent file you've retrieved from the clipboard.
176 TEST_F(ClipboardTest, FileTest) { 176 TEST_F(ClipboardTest, FileTest) {
177 Clipboard clipboard; 177 Clipboard clipboard;
178 #if defined(OS_WIN) 178 #if defined(OS_WIN)
179 FilePath file(L"C:\\Downloads\\My Downloads\\A Special File.txt"); 179 FilePath file(L"C:\\Downloads\\My Downloads\\A Special File.txt");
180 #elif defined(OS_MACOSX) 180 #elif defined(OS_MACOSX)
181 // OS X will print a warning message if we stick a non-existant file on the 181 // OS X will print a warning message if we stick a non-existant file on the
182 // clipboard. 182 // clipboard.
183 FilePath file("/usr/bin/make"); 183 FilePath file("/usr/bin/make");
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 clipboard_writer.WriteFiles(files); 217 clipboard_writer.WriteFiles(files);
218 } 218 }
219 219
220 std::vector<FilePath> out_files; 220 std::vector<FilePath> out_files;
221 clipboard.ReadFiles(&out_files); 221 clipboard.ReadFiles(&out_files);
222 222
223 EXPECT_EQ(files.size(), out_files.size()); 223 EXPECT_EQ(files.size(), out_files.size());
224 for (size_t i = 0; i < out_files.size(); ++i) 224 for (size_t i = 0; i < out_files.size(); ++i)
225 EXPECT_EQ(files[i].value(), out_files[i].value()); 225 EXPECT_EQ(files[i].value(), out_files[i].value());
226 } 226 }
227 #endif // !defined(OS_LINUX) 227 #endif // !defined(OS_LINUX) && !defined(OS_OPENBSD)
228 228
229 #if defined(OS_WIN) // Windows only tests. 229 #if defined(OS_WIN) // Windows only tests.
230 TEST_F(ClipboardTest, HyperlinkTest) { 230 TEST_F(ClipboardTest, HyperlinkTest) {
231 Clipboard clipboard; 231 Clipboard clipboard;
232 232
233 string16 title(ASCIIToUTF16("The Example Company")), title_result; 233 string16 title(ASCIIToUTF16("The Example Company")), title_result;
234 std::string url("http://www.example.com/"), url_result; 234 std::string url("http://www.example.com/"), url_result;
235 string16 html(ASCIIToUTF16("<a href=\"http://www.example.com/\">" 235 string16 html(ASCIIToUTF16("<a href=\"http://www.example.com/\">"
236 "The Example Company</a>")), html_result; 236 "The Example Company</a>")), html_result;
237 237
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 { 275 {
276 ScopedClipboardWriter clipboard_writer(&clipboard); 276 ScopedClipboardWriter clipboard_writer(&clipboard);
277 clipboard_writer.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4)); 277 clipboard_writer.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4));
278 } 278 }
279 279
280 EXPECT_EQ(true, clipboard.IsFormatAvailable( 280 EXPECT_EQ(true, clipboard.IsFormatAvailable(
281 Clipboard::GetBitmapFormatType())); 281 Clipboard::GetBitmapFormatType()));
282 } 282 }
283 #endif // defined(OS_WIN) 283 #endif // defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698