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

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

Issue 6864001: Move RenderProcess to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_process_impl.cc ('k') | chrome/renderer/renderer_glue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/sys_info.h"
6 #include "base/string_util.h"
7 #include "chrome/renderer/render_process_impl.h"
8 #include "ipc/ipc_channel.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/rect.h"
11
12 namespace {
13
14 static const char kThreadName[] = "render_process_unittest";
15
16 class RenderProcessTest : public testing::Test {
17 public:
18 virtual void SetUp() {
19 // Need a MODE_SERVER to make MODE_CLIENTs (like a RenderThread) happy.
20 channel_ = new IPC::Channel(kThreadName, IPC::Channel::MODE_SERVER, NULL);
21 render_process_.reset(new RenderProcessImpl);
22 }
23
24 virtual void TearDown() {
25 message_loop_.RunAllPending();
26 render_process_.reset();
27 // Need to fully destruct IPC::SyncChannel before the message loop goes
28 // away.
29 message_loop_.RunAllPending();
30 // Delete the server channel after the RenderThread so that
31 // IPC::SyncChannel's OnChannelError doesn't fire on the context and attempt
32 // to use the listener thread which is now gone.
33 delete channel_;
34 }
35
36 private:
37 MessageLoopForIO message_loop_;
38 scoped_ptr<RenderProcessImpl> render_process_;
39 IPC::Channel *channel_;
40 };
41
42
43 TEST_F(RenderProcessTest, TestTransportDIBAllocation) {
44 // On Mac, we allocate in the browser so this test is invalid.
45 #if !defined(OS_MACOSX)
46 const gfx::Rect rect(0, 0, 100, 100);
47 TransportDIB* dib;
48 skia::PlatformCanvas* canvas =
49 RenderProcess::current()->GetDrawingCanvas(&dib, rect);
50 ASSERT_TRUE(dib);
51 ASSERT_TRUE(canvas);
52 RenderProcess::current()->ReleaseTransportDIB(dib);
53 delete canvas;
54 #endif
55 }
56
57 } // namespace
OLDNEW
« no previous file with comments | « chrome/renderer/render_process_impl.cc ('k') | chrome/renderer/renderer_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698