| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "base/timer.h" | 8 #include "base/timer.h" |
| 9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
| 10 #include "content/browser/renderer_host/backing_store.h" | 10 #include "content/browser/renderer_host/backing_store.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 void Observe(int type, | 231 void Observe(int type, |
| 232 const content::NotificationSource& source, | 232 const content::NotificationSource& source, |
| 233 const content::NotificationDetails& details) { | 233 const content::NotificationDetails& details) { |
| 234 if (type == | 234 if (type == |
| 235 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK)
{ | 235 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK)
{ |
| 236 RenderWidgetHostImpl::PaintAtSizeAckDetails* size_ack_details = | 236 RenderWidgetHostImpl::PaintAtSizeAckDetails* size_ack_details = |
| 237 content::Details<RenderWidgetHostImpl::PaintAtSizeAckDetails>( | 237 content::Details<RenderWidgetHostImpl::PaintAtSizeAckDetails>( |
| 238 details).ptr(); | 238 details).ptr(); |
| 239 WidgetDidReceivePaintAtSizeAck( | 239 WidgetDidReceivePaintAtSizeAck( |
| 240 content::Source<RenderWidgetHostImpl>(source).ptr(), | 240 RenderWidgetHostImpl::From( |
| 241 content::Source<RenderWidgetHost>(source).ptr()), |
| 241 size_ack_details->tag, | 242 size_ack_details->tag, |
| 242 size_ack_details->size); | 243 size_ack_details->size); |
| 243 } | 244 } |
| 244 } | 245 } |
| 245 | 246 |
| 246 MockRenderWidgetHost* host() const { return host_; } | 247 MockRenderWidgetHost* host() const { return host_; } |
| 247 int tag() const { return tag_; } | 248 int tag() const { return tag_; } |
| 248 gfx::Size size() const { return size_; } | 249 gfx::Size size() const { return size_; } |
| 249 | 250 |
| 250 private: | 251 private: |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 host_->PaintAtSize(TransportDIB::GetFakeHandleForTest(), kPaintAtSizeTag, | 579 host_->PaintAtSize(TransportDIB::GetFakeHandleForTest(), kPaintAtSizeTag, |
| 579 gfx::Size(40, 60), gfx::Size(20, 30)); | 580 gfx::Size(40, 60), gfx::Size(20, 30)); |
| 580 EXPECT_TRUE( | 581 EXPECT_TRUE( |
| 581 process_->sink().GetUniqueMessageMatching(ViewMsg_PaintAtSize::ID)); | 582 process_->sink().GetUniqueMessageMatching(ViewMsg_PaintAtSize::ID)); |
| 582 | 583 |
| 583 content::NotificationRegistrar registrar; | 584 content::NotificationRegistrar registrar; |
| 584 MockPaintingObserver observer; | 585 MockPaintingObserver observer; |
| 585 registrar.Add( | 586 registrar.Add( |
| 586 &observer, | 587 &observer, |
| 587 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, | 588 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, |
| 588 content::Source<RenderWidgetHostImpl>(host_.get())); | 589 content::Source<RenderWidgetHost>(host_.get())); |
| 589 | 590 |
| 590 host_->OnMsgPaintAtSizeAck(kPaintAtSizeTag, gfx::Size(20, 30)); | 591 host_->OnMsgPaintAtSizeAck(kPaintAtSizeTag, gfx::Size(20, 30)); |
| 591 EXPECT_EQ(host_.get(), observer.host()); | 592 EXPECT_EQ(host_.get(), observer.host()); |
| 592 EXPECT_EQ(kPaintAtSizeTag, observer.tag()); | 593 EXPECT_EQ(kPaintAtSizeTag, observer.tag()); |
| 593 EXPECT_EQ(20, observer.size().width()); | 594 EXPECT_EQ(20, observer.size().width()); |
| 594 EXPECT_EQ(30, observer.size().height()); | 595 EXPECT_EQ(30, observer.size().height()); |
| 595 } | 596 } |
| 596 | 597 |
| 597 // Fails on Linux Aura, see http://crbug.com/100344 | 598 // Fails on Linux Aura, see http://crbug.com/100344 |
| 598 #if defined(USE_AURA) && !defined(OS_WIN) | 599 #if defined(USE_AURA) && !defined(OS_WIN) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 765 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
| 765 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 766 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
| 766 SendInputEventACK(WebInputEvent::RawKeyDown, true); | 767 SendInputEventACK(WebInputEvent::RawKeyDown, true); |
| 767 | 768 |
| 768 // Wait long enough for first timeout and see if it fired. | 769 // Wait long enough for first timeout and see if it fired. |
| 769 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 770 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 770 MessageLoop::QuitClosure(), 40); | 771 MessageLoop::QuitClosure(), 40); |
| 771 MessageLoop::current()->Run(); | 772 MessageLoop::current()->Run(); |
| 772 EXPECT_TRUE(host_->unresponsive_timer_fired()); | 773 EXPECT_TRUE(host_->unresponsive_timer_fired()); |
| 773 } | 774 } |
| OLD | NEW |