Commit 86066c2d authored by jam@chromium.org's avatar jam@chromium.org

Get rid of the last view_messages.h include in chrome, other than...

Get rid of the last view_messages.h include in chrome, other than tab_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
parent 54ccafa6
...@@ -94,12 +94,6 @@ class ThumbnailGeneratorTest : public testing::Test { ...@@ -94,12 +94,6 @@ class ThumbnailGeneratorTest : public testing::Test {
enum TransportType { TRANSPORT_BLACK, TRANSPORT_WHITE, TRANSPORT_OTHER }; enum TransportType { TRANSPORT_BLACK, TRANSPORT_WHITE, TRANSPORT_OTHER };
void SendPaint(TransportType type) { 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( scoped_ptr<skia::PlatformCanvas> canvas(
transport_dib_->GetPlatformCanvas(kBitmapWidth, kBitmapHeight)); transport_dib_->GetPlatformCanvas(kBitmapWidth, kBitmapHeight));
switch (type) { switch (type) {
...@@ -117,10 +111,8 @@ class ThumbnailGeneratorTest : public testing::Test { ...@@ -117,10 +111,8 @@ class ThumbnailGeneratorTest : public testing::Test {
break; break;
} }
params.bitmap = transport_dib_->id(); gfx::Rect rect(0, 0, kBitmapWidth, kBitmapHeight);
SimulateUpdateRect(widget_.get(), transport_dib_->id(), rect);
ViewHostMsg_UpdateRect msg(1, params);
widget_->OnMessageReceived(msg);
} }
TransportType ClassifyFirstPixel(const SkBitmap& bitmap) { TransportType ClassifyFirstPixel(const SkBitmap& bitmap) {
......
...@@ -40,6 +40,20 @@ void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, ...@@ -40,6 +40,20 @@ void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params,
params->content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); 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, TestRenderViewHost::TestRenderViewHost(SiteInstance* instance,
RenderViewHostDelegate* delegate, RenderViewHostDelegate* delegate,
int routing_id) int routing_id)
......
...@@ -38,6 +38,11 @@ void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, ...@@ -38,6 +38,11 @@ void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params,
const GURL& url, const GURL& url,
content::PageTransition transition_type); 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 // This file provides a testing framework for mocking out the RenderProcessHost
// layer. It allows you to test RenderViewHost, TabContents, // layer. It allows you to test RenderViewHost, TabContents,
// NavigationController, and other layers above that without running an actual // NavigationController, and other layers above that without running an actual
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment