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

Side by Side Diff: ui/base/clipboard/clipboard_test_template.h

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 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
« no previous file with comments | « ui/base/clipboard/clipboard_android.cc ('k') | ui/base/clipboard/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) 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 SkImageInfo::MakeN32Premul(size.width(), size.height()))); 387 SkImageInfo::MakeN32Premul(size.width(), size.height())));
388 bitmap.setPixels( 388 bitmap.setPixels(
389 const_cast<void*>(reinterpret_cast<const void*>(bitmap_data))); 389 const_cast<void*>(reinterpret_cast<const void*>(bitmap_data)));
390 scw.WriteImage(bitmap); 390 scw.WriteImage(bitmap);
391 } 391 }
392 392
393 EXPECT_TRUE(clipboard->IsFormatAvailable(Clipboard::GetBitmapFormatType(), 393 EXPECT_TRUE(clipboard->IsFormatAvailable(Clipboard::GetBitmapFormatType(),
394 CLIPBOARD_TYPE_COPY_PASTE)); 394 CLIPBOARD_TYPE_COPY_PASTE));
395 const SkBitmap& image = clipboard->ReadImage(CLIPBOARD_TYPE_COPY_PASTE); 395 const SkBitmap& image = clipboard->ReadImage(CLIPBOARD_TYPE_COPY_PASTE);
396 EXPECT_EQ(size, gfx::Size(image.width(), image.height())); 396 EXPECT_EQ(size, gfx::Size(image.width(), image.height()));
397 SkAutoLockPixels image_lock(image);
398 for (int j = 0; j < image.height(); ++j) { 397 for (int j = 0; j < image.height(); ++j) {
399 const uint32_t* row_address = image.getAddr32(0, j); 398 const uint32_t* row_address = image.getAddr32(0, j);
400 for (int i = 0; i < image.width(); ++i) { 399 for (int i = 0; i < image.width(); ++i) {
401 int offset = i + j * image.width(); 400 int offset = i + j * image.width();
402 EXPECT_EQ(bitmap_data[offset], row_address[i]) << "i = " << i 401 EXPECT_EQ(bitmap_data[offset], row_address[i]) << "i = " << i
403 << ", j = " << j; 402 << ", j = " << j;
404 } 403 }
405 } 404 }
406 } 405 }
407 406
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 ScopedClipboardWriter scw(CLIPBOARD_TYPE_COPY_PASTE); 674 ScopedClipboardWriter scw(CLIPBOARD_TYPE_COPY_PASTE);
676 scw.WritePickledData(base::Pickle(), Clipboard::GetPlainTextFormatType()); 675 scw.WritePickledData(base::Pickle(), Clipboard::GetPlainTextFormatType());
677 } 676 }
678 677
679 TYPED_TEST(ClipboardTest, WriteImageEmptyParams) { 678 TYPED_TEST(ClipboardTest, WriteImageEmptyParams) {
680 ScopedClipboardWriter scw(CLIPBOARD_TYPE_COPY_PASTE); 679 ScopedClipboardWriter scw(CLIPBOARD_TYPE_COPY_PASTE);
681 scw.WriteImage(SkBitmap()); 680 scw.WriteImage(SkBitmap());
682 } 681 }
683 682
684 } // namespace ui 683 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_android.cc ('k') | ui/base/clipboard/clipboard_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698