summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host/render_widget_host_unittest.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-16 21:41:02 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-16 21:41:02 +0000
commit67a46b7f6da205b7a1e772b7383bb20bab8ca611 (patch)
tree6345ab0ffb453906e3e4f8f87514b1e21649e6b6 /chrome/browser/renderer_host/render_widget_host_unittest.cc
parent3cc848c2747c8bc2ecede8e8df4eeb343d3d8988 (diff)
downloadchromium_src-67a46b7f6da205b7a1e772b7383bb20bab8ca611.zip
chromium_src-67a46b7f6da205b7a1e772b7383bb20bab8ca611.tar.gz
chromium_src-67a46b7f6da205b7a1e772b7383bb20bab8ca611.tar.bz2
Adds kind-of-live thumbnail generation for a potential tab switcher.
This listens to tab events and tries to keep thumbnails ready to go. See thumbnail_generator.cc for a more detailed design. This adds a painting observer to the RenderWidgetHost to enable this new behavior, as well as a notification to allow the thumbnail generator to hook its observer in. There is also a new notification that a backing store has been disabled, which required making the backing stores know about their owning widget hosts. This component is currently disabled. We just need to uncomment the member in Profile and it will start to work. Original review: http://codereview.chromium.org/118420 Review URL: http://codereview.chromium.org/126101 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/render_widget_host_unittest.cc')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_unittest.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_unittest.cc b/chrome/browser/renderer_host/render_widget_host_unittest.cc
index 083434d..f41aa29 100644
--- a/chrome/browser/renderer_host/render_widget_host_unittest.cc
+++ b/chrome/browser/renderer_host/render_widget_host_unittest.cc
@@ -100,7 +100,7 @@ bool RenderWidgetHostProcess::WaitForPaintMsg(int render_widget_id,
// This test view allows us to specify the size.
class TestView : public TestRenderWidgetHostView {
public:
- TestView() {}
+ TestView(RenderWidgetHost* rwh) : TestRenderWidgetHostView(rwh) {}
// Sets the bounds returned by GetViewBounds.
void set_bounds(const gfx::Rect& bounds) {
@@ -112,10 +112,6 @@ class TestView : public TestRenderWidgetHostView {
return bounds_;
}
- BackingStore* AllocBackingStore(const gfx::Size& size) {
- return new BackingStore(size);
- }
-
protected:
gfx::Rect bounds_;
DISALLOW_COPY_AND_ASSIGN(TestView);
@@ -160,7 +156,7 @@ class RenderWidgetHostTest : public testing::Test {
profile_.reset(new TestingProfile());
process_ = new RenderWidgetHostProcess(profile_.get());
host_.reset(new MockRenderWidgetHost(process_, 1));
- view_.reset(new TestView);
+ view_.reset(new TestView(host_.get()));
host_->set_view(view_.get());
host_->Init();
}
@@ -303,7 +299,7 @@ TEST_F(RenderWidgetHostTest, GetBackingStore_NoRepaintAck) {
// We don't currently have a backing store, and if the renderer doesn't send
// one in time, we should get nothing.
process_->set_paint_msg_should_reply(false);
- BackingStore* backing = host_->GetBackingStore();
+ BackingStore* backing = host_->GetBackingStore(true);
EXPECT_FALSE(backing);
// The widget host should have sent a request for a repaint, and there should
// be no paint ACK.
@@ -315,7 +311,7 @@ TEST_F(RenderWidgetHostTest, GetBackingStore_NoRepaintAck) {
process_->sink().ClearMessages();
process_->set_paint_msg_should_reply(true);
process_->set_paint_msg_reply_flags(0);
- backing = host_->GetBackingStore();
+ backing = host_->GetBackingStore(true);
EXPECT_TRUE(backing);
// The widget host should NOT have sent a request for a repaint, since there
// was an ACK already pending.
@@ -331,7 +327,7 @@ TEST_F(RenderWidgetHostTest, GetBackingStore_RepaintAck) {
process_->set_paint_msg_should_reply(true);
process_->set_paint_msg_reply_flags(
ViewHostMsg_PaintRect_Flags::IS_REPAINT_ACK);
- BackingStore* backing = host_->GetBackingStore();
+ BackingStore* backing = host_->GetBackingStore(true);
EXPECT_TRUE(backing);
// We still should not have sent out a repaint request since the last flags
// didn't have the repaint ack set, and the pending flag will still be set.
@@ -342,7 +338,7 @@ TEST_F(RenderWidgetHostTest, GetBackingStore_RepaintAck) {
// Asking again for the backing store should just re-use the existing one
// and not send any messagse.
process_->sink().ClearMessages();
- backing = host_->GetBackingStore();
+ backing = host_->GetBackingStore(true);
EXPECT_TRUE(backing);
EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID));
EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(