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

Side by Side Diff: chrome/renderer/render_process_unittest.cc

Issue 21485: Bitmap transport (Closed)
Patch Set: Fix some mac crashes Created 11 years, 10 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gfx/rect.h"
5 #include "base/sys_info.h" 6 #include "base/sys_info.h"
6 #include "base/string_util.h" 7 #include "base/string_util.h"
7 #include "chrome/renderer/render_process.h" 8 #include "chrome/renderer/render_process.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 namespace { 11 namespace {
11 12
12 class RenderProcessTest : public testing::Test { 13 class RenderProcessTest : public testing::Test {
13 public: 14 public:
14 virtual void SetUp() { 15 virtual void SetUp() {
15 RenderProcess::GlobalInit(L"render_process_unittest"); 16 RenderProcess::GlobalInit(L"render_process_unittest");
16 } 17 }
17 18
18 virtual void TearDown() { 19 virtual void TearDown() {
19 RenderProcess::GlobalCleanup(); 20 RenderProcess::GlobalCleanup();
20 } 21 }
21 22
22 private: 23 private:
23 MessageLoopForIO message_loop_; 24 MessageLoopForIO message_loop_;
24 }; 25 };
25 26
26 27
27 TEST_F(RenderProcessTest, TestSharedMemoryAllocOne) { 28 TEST_F(RenderProcessTest, TestTransportDIBAllocation) {
28 size_t size = base::SysInfo::VMAllocationGranularity(); 29 const gfx::Rect rect(0, 0, 100, 100);
29 base::SharedMemory* mem = RenderProcess::AllocSharedMemory(size); 30 TransportDIB* dib;
30 ASSERT_TRUE(mem); 31 skia::PlatformCanvas* canvas = RenderProcess::GetDrawingCanvas(&dib, rect);
31 RenderProcess::FreeSharedMemory(mem); 32 ASSERT_TRUE(dib);
33 ASSERT_TRUE(canvas);
34 RenderProcess::ReleaseTransportDIB(dib);
35 delete canvas;
32 } 36 }
33 37
34 } // namespace 38 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698