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 // Note: This header doesn't use REGISTER_TYPED_TEST_CASE_P like most | 5 // Note: This header doesn't use REGISTER_TYPED_TEST_CASE_P like most |
6 // type-parameterized gtests. There are lot of test cases in here that are only | 6 // type-parameterized gtests. There are lot of test cases in here that are only |
7 // enabled on certain platforms. However, preprocessor directives in macro | 7 // enabled on certain platforms. However, preprocessor directives in macro |
8 // arguments result in undefined behavior (and don't work on MSVC). Instead, | 8 // arguments result in undefined behavior (and don't work on MSVC). Instead, |
9 // 'parameterized' tests should typedef TypesToTest (which is used to | 9 // 'parameterized' tests should typedef TypesToTest (which is used to |
10 // instantiate the tests using the TYPED_TEST_CASE macro) and then #include this | 10 // instantiate the tests using the TYPED_TEST_CASE macro) and then #include this |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 0xa6910313, 0x8302323e, | 430 0xa6910313, 0x8302323e, |
431 }; | 431 }; |
432 { | 432 { |
433 SCOPED_TRACE("second bitmap"); | 433 SCOPED_TRACE("second bitmap"); |
434 TestBitmapWrite(&this->clipboard(), gfx::Size(2, 7), fake_bitmap_2); | 434 TestBitmapWrite(&this->clipboard(), gfx::Size(2, 7), fake_bitmap_2); |
435 } | 435 } |
436 } | 436 } |
437 | 437 |
438 TYPED_TEST(ClipboardTest, DataTest) { | 438 TYPED_TEST(ClipboardTest, DataTest) { |
439 const ui::Clipboard::FormatType kFormat = | 439 const ui::Clipboard::FormatType kFormat = |
440 ui::Clipboard::GetFormatType("chromium/x-test-format"); | 440 ui::Clipboard::GetFormatType("chromium/x-web-custom-data"); |
sadrul
2017/06/01 20:45:31
These seem unrelated to this CL.
Tom Anderson
2017/06/01 21:20:42
Reverted this now that the NOTREACHED is gone
| |
441 std::string payload("test string"); | 441 std::string payload("test string"); |
442 base::Pickle write_pickle; | 442 base::Pickle write_pickle; |
443 write_pickle.WriteString(payload); | 443 write_pickle.WriteString(payload); |
444 | 444 |
445 { | 445 { |
446 ScopedClipboardWriter clipboard_writer(CLIPBOARD_TYPE_COPY_PASTE); | 446 ScopedClipboardWriter clipboard_writer(CLIPBOARD_TYPE_COPY_PASTE); |
447 clipboard_writer.WritePickledData(write_pickle, kFormat); | 447 clipboard_writer.WritePickledData(write_pickle, kFormat); |
448 } | 448 } |
449 | 449 |
450 ASSERT_TRUE( | 450 ASSERT_TRUE( |
451 this->clipboard().IsFormatAvailable(kFormat, CLIPBOARD_TYPE_COPY_PASTE)); | 451 this->clipboard().IsFormatAvailable(kFormat, CLIPBOARD_TYPE_COPY_PASTE)); |
452 std::string output; | 452 std::string output; |
453 this->clipboard().ReadData(kFormat, &output); | 453 this->clipboard().ReadData(kFormat, &output); |
454 ASSERT_FALSE(output.empty()); | 454 ASSERT_FALSE(output.empty()); |
455 | 455 |
456 base::Pickle read_pickle(output.data(), static_cast<int>(output.size())); | 456 base::Pickle read_pickle(output.data(), static_cast<int>(output.size())); |
457 base::PickleIterator iter(read_pickle); | 457 base::PickleIterator iter(read_pickle); |
458 std::string unpickled_string; | 458 std::string unpickled_string; |
459 ASSERT_TRUE(iter.ReadString(&unpickled_string)); | 459 ASSERT_TRUE(iter.ReadString(&unpickled_string)); |
460 EXPECT_EQ(payload, unpickled_string); | 460 EXPECT_EQ(payload, unpickled_string); |
461 } | 461 } |
462 | 462 |
463 TYPED_TEST(ClipboardTest, MultipleDataTest) { | 463 TYPED_TEST(ClipboardTest, MultipleDataTest) { |
464 const ui::Clipboard::FormatType kFormat1 = | 464 const ui::Clipboard::FormatType kFormat1 = |
465 ui::Clipboard::GetFormatType("chromium/x-test-format1"); | 465 ui::Clipboard::GetFormatType("chromium/x-bookmark-entries"); |
466 std::string payload1("test string1"); | 466 std::string payload1("test string1"); |
467 base::Pickle write_pickle1; | 467 base::Pickle write_pickle1; |
468 write_pickle1.WriteString(payload1); | 468 write_pickle1.WriteString(payload1); |
469 | 469 |
470 const ui::Clipboard::FormatType kFormat2 = | 470 const ui::Clipboard::FormatType kFormat2 = |
471 ui::Clipboard::GetFormatType("chromium/x-test-format2"); | 471 ui::Clipboard::GetFormatType("chromium/x-browser-actions"); |
472 std::string payload2("test string2"); | 472 std::string payload2("test string2"); |
473 base::Pickle write_pickle2; | 473 base::Pickle write_pickle2; |
474 write_pickle2.WriteString(payload2); | 474 write_pickle2.WriteString(payload2); |
475 | 475 |
476 { | 476 { |
477 ScopedClipboardWriter clipboard_writer(CLIPBOARD_TYPE_COPY_PASTE); | 477 ScopedClipboardWriter clipboard_writer(CLIPBOARD_TYPE_COPY_PASTE); |
478 clipboard_writer.WritePickledData(write_pickle1, kFormat1); | 478 clipboard_writer.WritePickledData(write_pickle1, kFormat1); |
479 // overwrite the previous pickle for fun | 479 // overwrite the previous pickle for fun |
480 clipboard_writer.WritePickledData(write_pickle2, kFormat2); | 480 clipboard_writer.WritePickledData(write_pickle2, kFormat2); |
481 } | 481 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 ScopedClipboardWriter scw(CLIPBOARD_TYPE_COPY_PASTE); | 679 ScopedClipboardWriter scw(CLIPBOARD_TYPE_COPY_PASTE); |
680 scw.WritePickledData(base::Pickle(), Clipboard::GetPlainTextFormatType()); | 680 scw.WritePickledData(base::Pickle(), Clipboard::GetPlainTextFormatType()); |
681 } | 681 } |
682 | 682 |
683 TYPED_TEST(ClipboardTest, WriteImageEmptyParams) { | 683 TYPED_TEST(ClipboardTest, WriteImageEmptyParams) { |
684 ScopedClipboardWriter scw(CLIPBOARD_TYPE_COPY_PASTE); | 684 ScopedClipboardWriter scw(CLIPBOARD_TYPE_COPY_PASTE); |
685 scw.WriteImage(SkBitmap()); | 685 scw.WriteImage(SkBitmap()); |
686 } | 686 } |
687 | 687 |
688 } // namespace ui | 688 } // namespace ui |
OLD | NEW |