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

Side by Side Diff: base/clipboard_unittest.cc

Issue 194052: Clipboard:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fixes Created 11 years, 3 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
« no previous file with comments | « base/clipboard_mac.mm ('k') | base/clipboard_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 std::string unpickled_string; 251 std::string unpickled_string;
252 ASSERT_TRUE(read_pickle.ReadString(&iter, &unpickled_string)); 252 ASSERT_TRUE(read_pickle.ReadString(&iter, &unpickled_string));
253 EXPECT_EQ(payload, unpickled_string); 253 EXPECT_EQ(payload, unpickled_string);
254 } 254 }
255 #endif 255 #endif
256 256
257 #if defined(OS_WIN) // Windows only tests. 257 #if defined(OS_WIN) // Windows only tests.
258 TEST_F(ClipboardTest, HyperlinkTest) { 258 TEST_F(ClipboardTest, HyperlinkTest) {
259 Clipboard clipboard; 259 Clipboard clipboard;
260 260
261 string16 title(ASCIIToUTF16("The Example Company")), title_result; 261 std::string title("The Example Company");
262 std::string url("http://www.example.com/"), url_result; 262 std::string url("http://www.example.com/"), url_result;
263 string16 html(ASCIIToUTF16("<a href=\"http://www.example.com/\">" 263 std::string html("<a href=\"http://www.example.com/\">"
264 "The Example Company</a>")), html_result; 264 "The Example Company</a>");
265 string16 html_result;
265 266
266 { 267 {
267 ScopedClipboardWriter clipboard_writer(&clipboard); 268 ScopedClipboardWriter clipboard_writer(&clipboard);
268 clipboard_writer.WriteHyperlink(title, url); 269 clipboard_writer.WriteHyperlink(title, url);
269 } 270 }
270 271
271 EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetUrlWFormatType(), 272 EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetUrlWFormatType(),
272 Clipboard::BUFFER_STANDARD)); 273 Clipboard::BUFFER_STANDARD));
273 EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(), 274 EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(),
274 Clipboard::BUFFER_STANDARD)); 275 Clipboard::BUFFER_STANDARD));
275 clipboard.ReadBookmark(&title_result, &url_result);
276 EXPECT_EQ(title, title_result);
277 EXPECT_EQ(url, url_result);
278 clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &html_result, &url_result); 276 clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &html_result, &url_result);
279 EXPECT_EQ(html, html_result); 277 EXPECT_EQ(UTF8ToUTF16(html), html_result);
280 } 278 }
281 279
282 TEST_F(ClipboardTest, WebSmartPasteTest) { 280 TEST_F(ClipboardTest, WebSmartPasteTest) {
283 Clipboard clipboard; 281 Clipboard clipboard;
284 282
285 { 283 {
286 ScopedClipboardWriter clipboard_writer(&clipboard); 284 ScopedClipboardWriter clipboard_writer(&clipboard);
287 clipboard_writer.WriteWebSmartPaste(); 285 clipboard_writer.WriteWebSmartPaste();
288 } 286 }
289 287
(...skipping 12 matching lines...) Expand all
302 300
303 { 301 {
304 ScopedClipboardWriter clipboard_writer(&clipboard); 302 ScopedClipboardWriter clipboard_writer(&clipboard);
305 clipboard_writer.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4)); 303 clipboard_writer.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4));
306 } 304 }
307 305
308 EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetBitmapFormatType(), 306 EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetBitmapFormatType(),
309 Clipboard::BUFFER_STANDARD)); 307 Clipboard::BUFFER_STANDARD));
310 } 308 }
311 #endif // defined(OS_WIN) 309 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « base/clipboard_mac.mm ('k') | base/clipboard_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698