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

Side by Side Diff: content/browser/renderer_host/clipboard_message_filter_unittest.cc

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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/renderer_host/clipboard_message_filter.h" 5 #include "content/browser/renderer_host/clipboard_message_filter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 CallCommitWrite(); 96 CallCommitWrite();
97 97
98 EXPECT_NE(sequence_number, 98 EXPECT_NE(sequence_number,
99 clipboard()->GetSequenceNumber(ui::CLIPBOARD_TYPE_COPY_PASTE)); 99 clipboard()->GetSequenceNumber(ui::CLIPBOARD_TYPE_COPY_PASTE));
100 EXPECT_FALSE(clipboard()->IsFormatAvailable( 100 EXPECT_FALSE(clipboard()->IsFormatAvailable(
101 ui::Clipboard::GetPlainTextFormatType(), ui::CLIPBOARD_TYPE_COPY_PASTE)); 101 ui::Clipboard::GetPlainTextFormatType(), ui::CLIPBOARD_TYPE_COPY_PASTE));
102 EXPECT_TRUE(clipboard()->IsFormatAvailable( 102 EXPECT_TRUE(clipboard()->IsFormatAvailable(
103 ui::Clipboard::GetBitmapFormatType(), ui::CLIPBOARD_TYPE_COPY_PASTE)); 103 ui::Clipboard::GetBitmapFormatType(), ui::CLIPBOARD_TYPE_COPY_PASTE));
104 104
105 SkBitmap actual = clipboard()->ReadImage(ui::CLIPBOARD_TYPE_COPY_PASTE); 105 SkBitmap actual = clipboard()->ReadImage(ui::CLIPBOARD_TYPE_COPY_PASTE);
106 SkAutoLockPixels locked(actual);
107 EXPECT_EQ(sizeof(bitmap_data), actual.getSize()); 106 EXPECT_EQ(sizeof(bitmap_data), actual.getSize());
108 EXPECT_EQ(0, 107 EXPECT_EQ(0,
109 memcmp(bitmap_data, actual.getAddr32(0, 0), sizeof(bitmap_data))); 108 memcmp(bitmap_data, actual.getAddr32(0, 0), sizeof(bitmap_data)));
110 } 109 }
111 110
112 // Test with a size that would overflow a naive 32-bit row bytes calculation. 111 // Test with a size that would overflow a naive 32-bit row bytes calculation.
113 TEST_F(ClipboardMessageFilterTest, ImageSizeOverflows32BitRowBytes) { 112 TEST_F(ClipboardMessageFilterTest, ImageSizeOverflows32BitRowBytes) {
114 std::unique_ptr<base::SharedMemory> shared_memory = 113 std::unique_ptr<base::SharedMemory> shared_memory =
115 CreateReadOnlySharedMemory(0x20000000); 114 CreateReadOnlySharedMemory(0x20000000);
116 115
(...skipping 10 matching lines...) Expand all
127 CallWriteImageDirectly(gfx::Size(5, 5), base::SharedMemory::NULLHandle()); 126 CallWriteImageDirectly(gfx::Size(5, 5), base::SharedMemory::NULLHandle());
128 uint64_t sequence_number = 127 uint64_t sequence_number =
129 clipboard()->GetSequenceNumber(ui::CLIPBOARD_TYPE_COPY_PASTE); 128 clipboard()->GetSequenceNumber(ui::CLIPBOARD_TYPE_COPY_PASTE);
130 CallCommitWrite(); 129 CallCommitWrite();
131 130
132 EXPECT_EQ(sequence_number, 131 EXPECT_EQ(sequence_number,
133 clipboard()->GetSequenceNumber(ui::CLIPBOARD_TYPE_COPY_PASTE)); 132 clipboard()->GetSequenceNumber(ui::CLIPBOARD_TYPE_COPY_PASTE));
134 } 133 }
135 134
136 } // namespace content 135 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/capture/cursor_renderer.cc ('k') | content/browser/renderer_host/delegated_frame_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698