| OLD | NEW |
| 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/gfx/rect.h" |
| 6 #include "base/sys_info.h" | 6 #include "base/sys_info.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/renderer/render_process.h" | 8 #include "chrome/renderer/render_process.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 static const char kThreadName[] = "render_process_unittest"; | 13 static const char kThreadName[] = "render_process_unittest"; |
| 14 | 14 |
| 15 class RenderProcessTest : public testing::Test { | 15 class RenderProcessTest : public testing::Test { |
| 16 public: | 16 public: |
| 17 virtual void SetUp() { | 17 virtual void SetUp() { |
| 18 // Need a MODE_SERVER to make MODE_CLIENTs (like a RenderThread) happy. | 18 // Need a MODE_SERVER to make MODE_CLIENTs (like a RenderThread) happy. |
| 19 channel_ = new IPC::Channel(kThreadName, IPC::Channel::MODE_SERVER, NULL); | 19 channel_ = new IPC::Channel(kThreadName, IPC::Channel::MODE_SERVER, NULL); |
| 20 render_process_.reset(new RenderProcess(kThreadName)); | 20 render_process_.reset(new RenderProcess()); |
| 21 } | 21 } |
| 22 | 22 |
| 23 virtual void TearDown() { | 23 virtual void TearDown() { |
| 24 message_loop_.RunAllPending(); | 24 message_loop_.RunAllPending(); |
| 25 render_process_.reset(); | 25 render_process_.reset(); |
| 26 // Need to fully destruct IPC::SyncChannel before the message loop goes | 26 // Need to fully destruct IPC::SyncChannel before the message loop goes |
| 27 // away. | 27 // away. |
| 28 message_loop_.RunAllPending(); | 28 message_loop_.RunAllPending(); |
| 29 // Delete the server channel after the RenderThread so that | 29 // Delete the server channel after the RenderThread so that |
| 30 // IPC::SyncChannel's OnChannelError doesn't fire on the context and attempt | 30 // IPC::SyncChannel's OnChannelError doesn't fire on the context and attempt |
| (...skipping 16 matching lines...) Expand all Loading... |
| 47 skia::PlatformCanvas* canvas = | 47 skia::PlatformCanvas* canvas = |
| 48 RenderProcess::current()->GetDrawingCanvas(&dib, rect); | 48 RenderProcess::current()->GetDrawingCanvas(&dib, rect); |
| 49 ASSERT_TRUE(dib); | 49 ASSERT_TRUE(dib); |
| 50 ASSERT_TRUE(canvas); | 50 ASSERT_TRUE(canvas); |
| 51 RenderProcess::current()->ReleaseTransportDIB(dib); | 51 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 52 delete canvas; | 52 delete canvas; |
| 53 #endif | 53 #endif |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace | 56 } // namespace |
| OLD | NEW |