OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 #endif // defined(OS_WIN) | 219 #endif // defined(OS_WIN) |
220 | 220 |
221 #if defined(TOOLKIT_GTK) | 221 #if defined(TOOLKIT_GTK) |
222 // Regression test for crbug.com/56298 (pasting empty HTML crashes Linux). | 222 // Regression test for crbug.com/56298 (pasting empty HTML crashes Linux). |
223 TEST_F(ClipboardTest, EmptyHTMLTest) { | 223 TEST_F(ClipboardTest, EmptyHTMLTest) { |
224 // ScopedClipboardWriter doesn't let us write empty data to the clipboard. | 224 // ScopedClipboardWriter doesn't let us write empty data to the clipboard. |
225 clipboard().clipboard_data_ = new Clipboard::TargetMap(); | 225 clipboard().clipboard_data_ = new Clipboard::TargetMap(); |
226 // The 1 is so the compiler doesn't warn about allocating an empty array. | 226 // The 1 is so the compiler doesn't warn about allocating an empty array. |
227 char* empty = new char[1]; | 227 char* empty = new char[1]; |
228 clipboard().InsertMapping("text/html", empty, 0U); | 228 clipboard().InsertMapping("text/html", empty, 0U); |
229 clipboard().SetGtkClipboard(Clipboard::BUFFER_STANDARD); | 229 clipboard().SetGtkClipboard(Clipboard::BUFFER_STANDARD, |
| 230 Clipboard::SourceTag()); |
230 | 231 |
231 EXPECT_TRUE(clipboard().IsFormatAvailable(Clipboard::GetHtmlFormatType(), | 232 EXPECT_TRUE(clipboard().IsFormatAvailable(Clipboard::GetHtmlFormatType(), |
232 Clipboard::BUFFER_STANDARD)); | 233 Clipboard::BUFFER_STANDARD)); |
233 string16 markup_result; | 234 string16 markup_result; |
234 std::string url_result; | 235 std::string url_result; |
235 uint32 ignored; | 236 uint32 ignored; |
236 clipboard().ReadHTML(Clipboard::BUFFER_STANDARD, &markup_result, &url_result, | 237 clipboard().ReadHTML(Clipboard::BUFFER_STANDARD, &markup_result, &url_result, |
237 &ignored, &ignored); | 238 &ignored, &ignored); |
238 EXPECT_PRED2(MarkupMatches, string16(), markup_result); | 239 EXPECT_PRED2(MarkupMatches, string16(), markup_result); |
239 } | 240 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 size_param.push_back(size_data[i]); | 354 size_param.push_back(size_data[i]); |
354 | 355 |
355 Clipboard::ObjectMapParams params; | 356 Clipboard::ObjectMapParams params; |
356 params.push_back(placeholder_param); | 357 params.push_back(placeholder_param); |
357 params.push_back(size_param); | 358 params.push_back(size_param); |
358 | 359 |
359 Clipboard::ObjectMap objects; | 360 Clipboard::ObjectMap objects; |
360 objects[Clipboard::CBF_SMBITMAP] = params; | 361 objects[Clipboard::CBF_SMBITMAP] = params; |
361 Clipboard::ReplaceSharedMemHandle(&objects, handle_to_share, current_process); | 362 Clipboard::ReplaceSharedMemHandle(&objects, handle_to_share, current_process); |
362 | 363 |
363 clipboard().WriteObjects(Clipboard::BUFFER_STANDARD, objects); | 364 clipboard().WriteObjects(Clipboard::BUFFER_STANDARD, |
| 365 objects, |
| 366 Clipboard::SourceTag()); |
364 | 367 |
365 EXPECT_TRUE(clipboard().IsFormatAvailable(Clipboard::GetBitmapFormatType(), | 368 EXPECT_TRUE(clipboard().IsFormatAvailable(Clipboard::GetBitmapFormatType(), |
366 Clipboard::BUFFER_STANDARD)); | 369 Clipboard::BUFFER_STANDARD)); |
367 } | 370 } |
368 #endif | 371 #endif |
369 | 372 |
370 // The following test somehow fails on GTK. The image when read back from the | 373 // The following test somehow fails on GTK. The image when read back from the |
371 // clipboard has the alpha channel set to 0xFF for some reason. The other | 374 // clipboard has the alpha channel set to 0xFF for some reason. The other |
372 // channels stay intact. So I am turning this on only for aura. | 375 // channels stay intact. So I am turning this on only for aura. |
373 // | 376 // |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 EXPECT_TRUE(clipboard().IsFormatAvailable( | 690 EXPECT_TRUE(clipboard().IsFormatAvailable( |
688 Clipboard::GetPlainTextWFormatType(), Clipboard::BUFFER_STANDARD)); | 691 Clipboard::GetPlainTextWFormatType(), Clipboard::BUFFER_STANDARD)); |
689 | 692 |
690 // Make sure the text is what we inserted while simulating the other app | 693 // Make sure the text is what we inserted while simulating the other app |
691 std::string contents; | 694 std::string contents; |
692 clipboard().ReadAsciiText(Clipboard::BUFFER_STANDARD, &contents); | 695 clipboard().ReadAsciiText(Clipboard::BUFFER_STANDARD, &contents); |
693 EXPECT_EQ(contents, new_value); | 696 EXPECT_EQ(contents, new_value); |
694 } | 697 } |
695 #endif | 698 #endif |
696 } // namespace ui | 699 } // namespace ui |
OLD | NEW |