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

Side by Side Diff: ui/gfx/blit_unittest.cc

Issue 1320783002: Make SharedMemoryHandle a class on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_global
Patch Set: Rebase. Created 5 years, 2 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 | « sandbox/win/tests/common/controller.cc ('k') | ui/surface/transport_dib.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/shared_memory.h" 6 #include "base/memory/shared_memory.h"
7 #include "skia/ext/platform_canvas.h" 7 #include "skia/ext/platform_canvas.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/blit.h" 9 #include "ui/gfx/blit.h"
10 #include "ui/gfx/geometry/point.h" 10 #include "ui/gfx/geometry/point.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 #if defined(OS_WIN) 144 #if defined(OS_WIN)
145 145
146 TEST(Blit, WithSharedMemory) { 146 TEST(Blit, WithSharedMemory) {
147 const int kCanvasWidth = 5; 147 const int kCanvasWidth = 5;
148 const int kCanvasHeight = 5; 148 const int kCanvasHeight = 5;
149 base::SharedMemory shared_mem; 149 base::SharedMemory shared_mem;
150 ASSERT_TRUE(shared_mem.CreateAnonymous(kCanvasWidth * kCanvasHeight)); 150 ASSERT_TRUE(shared_mem.CreateAnonymous(kCanvasWidth * kCanvasHeight));
151 base::SharedMemoryHandle section = shared_mem.handle(); 151 base::SharedMemoryHandle section = shared_mem.handle();
152 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef( 152 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(skia::CreatePlatformCanvas(
153 skia::CreatePlatformCanvas(kCanvasWidth, kCanvasHeight, true, section, 153 kCanvasWidth, kCanvasHeight, true, section.GetHandle(),
154 skia::RETURN_NULL_ON_FAILURE)); 154 skia::RETURN_NULL_ON_FAILURE));
155 ASSERT_TRUE(canvas); 155 ASSERT_TRUE(canvas);
156 shared_mem.Close(); 156 shared_mem.Close();
157 157
158 uint8 initial_values[kCanvasHeight][kCanvasWidth] = { 158 uint8 initial_values[kCanvasHeight][kCanvasWidth] = {
159 { 0x00, 0x01, 0x02, 0x03, 0x04 }, 159 { 0x00, 0x01, 0x02, 0x03, 0x04 },
160 { 0x10, 0x11, 0x12, 0x13, 0x14 }, 160 { 0x10, 0x11, 0x12, 0x13, 0x14 },
161 { 0x20, 0x21, 0x22, 0x23, 0x24 }, 161 { 0x20, 0x21, 0x22, 0x23, 0x24 },
162 { 0x30, 0x31, 0x32, 0x33, 0x34 }, 162 { 0x30, 0x31, 0x32, 0x33, 0x34 },
163 { 0x40, 0x41, 0x42, 0x43, 0x44 }}; 163 { 0x40, 0x41, 0x42, 0x43, 0x44 }};
164 SetToCanvas<5, 5>(canvas.get(), initial_values); 164 SetToCanvas<5, 5>(canvas.get(), initial_values);
165 165
166 // Sanity check on input. 166 // Sanity check on input.
167 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); 167 VerifyCanvasValues<5, 5>(canvas.get(), initial_values);
168 } 168 }
169 169
170 #endif 170 #endif
171 171
OLDNEW
« no previous file with comments | « sandbox/win/tests/common/controller.cc ('k') | ui/surface/transport_dib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698