Skip to content

Commit

Permalink
Get rid of the last view_messages.h include in chrome, other than tab…
Browse files Browse the repository at this point in the history
…_contents_views_mac.mm and render_view_host_delegate_helper.cc, both of which Avi is working on. I added a test method to fake a UpdateRect IPC message for the thumbnail test.

BUG=98716

Review URL: http://codereview.chromium.org/8819005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113285 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jam@chromium.org committed Dec 6, 2011
1 parent 54ccafa commit 86066c2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
12 changes: 2 additions & 10 deletions chrome/browser/tab_contents/thumbnail_generator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ class ThumbnailGeneratorTest : public testing::Test {
enum TransportType { TRANSPORT_BLACK, TRANSPORT_WHITE, TRANSPORT_OTHER };

void SendPaint(TransportType type) {
ViewHostMsg_UpdateRect_Params params;
params.bitmap_rect = gfx::Rect(0, 0, kBitmapWidth, kBitmapHeight);
params.view_size = params.bitmap_rect.size();
params.copy_rects.push_back(params.bitmap_rect);
params.flags = 0;

scoped_ptr<skia::PlatformCanvas> canvas(
transport_dib_->GetPlatformCanvas(kBitmapWidth, kBitmapHeight));
switch (type) {
Expand All @@ -117,10 +111,8 @@ class ThumbnailGeneratorTest : public testing::Test {
break;
}

params.bitmap = transport_dib_->id();

ViewHostMsg_UpdateRect msg(1, params);
widget_->OnMessageReceived(msg);
gfx::Rect rect(0, 0, kBitmapWidth, kBitmapHeight);
SimulateUpdateRect(widget_.get(), transport_dib_->id(), rect);
}

TransportType ClassifyFirstPixel(const SkBitmap& bitmap) {
Expand Down
14 changes: 14 additions & 0 deletions content/browser/renderer_host/test_render_view_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params,
params->content_state = webkit_glue::CreateHistoryStateForURL(GURL(url));
}

void SimulateUpdateRect(RenderWidgetHost* widget,
TransportDIB::Id bitmap,
const gfx::Rect& rect) {
ViewHostMsg_UpdateRect_Params params;
params.bitmap_rect = rect;
params.view_size = params.bitmap_rect.size();
params.copy_rects.push_back(params.bitmap_rect);
params.flags = 0;
params.bitmap = bitmap;

ViewHostMsg_UpdateRect msg(1, params);
widget->OnMessageReceived(msg);
}

TestRenderViewHost::TestRenderViewHost(SiteInstance* instance,
RenderViewHostDelegate* delegate,
int routing_id)
Expand Down
5 changes: 5 additions & 0 deletions content/browser/renderer_host/test_render_view_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params,
const GURL& url,
content::PageTransition transition_type);

// Utility function to fake the ViewHostMsg_UpdateRect IPC arriving at a RWH.
void SimulateUpdateRect(RenderWidgetHost* widget,
TransportDIB::Id bitmap,
const gfx::Rect& rect);

// This file provides a testing framework for mocking out the RenderProcessHost
// layer. It allows you to test RenderViewHost, TabContents,
// NavigationController, and other layers above that without running an actual
Expand Down

0 comments on commit 86066c2

Please sign in to comment.