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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 ViewHostMsg_UpdateRect_Params params; | 617 ViewHostMsg_UpdateRect_Params params; |
618 process_->InitUpdateRectParams(¶ms); | 618 process_->InitUpdateRectParams(¶ms); |
619 host_->OnMsgUpdateRect(params); | 619 host_->OnMsgUpdateRect(params); |
620 | 620 |
621 // It should have sent out the ACK. | 621 // It should have sent out the ACK. |
622 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( | 622 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( |
623 ViewMsg_UpdateRect_ACK::ID)); | 623 ViewMsg_UpdateRect_ACK::ID)); |
624 | 624 |
625 // Now unhide. | 625 // Now unhide. |
626 process_->sink().ClearMessages(); | 626 process_->sink().ClearMessages(); |
627 host_->WasRestored(); | 627 host_->WasShown(); |
628 EXPECT_FALSE(host_->is_hidden_); | 628 EXPECT_FALSE(host_->is_hidden_); |
629 | 629 |
630 // It should have sent out a restored message with a request to paint. | 630 // It should have sent out a restored message with a request to paint. |
631 const IPC::Message* restored = process_->sink().GetUniqueMessageMatching( | 631 const IPC::Message* restored = process_->sink().GetUniqueMessageMatching( |
632 ViewMsg_WasRestored::ID); | 632 ViewMsg_WasShown::ID); |
633 ASSERT_TRUE(restored); | 633 ASSERT_TRUE(restored); |
634 Tuple1<bool> needs_repaint; | 634 Tuple1<bool> needs_repaint; |
635 ViewMsg_WasRestored::Read(restored, &needs_repaint); | 635 ViewMsg_WasShown::Read(restored, &needs_repaint); |
636 EXPECT_TRUE(needs_repaint.a); | 636 EXPECT_TRUE(needs_repaint.a); |
637 } | 637 } |
638 | 638 |
639 TEST_F(RenderWidgetHostTest, PaintAtSize) { | 639 TEST_F(RenderWidgetHostTest, PaintAtSize) { |
640 const int kPaintAtSizeTag = 42; | 640 const int kPaintAtSizeTag = 42; |
641 host_->PaintAtSize(TransportDIB::GetFakeHandleForTest(), kPaintAtSizeTag, | 641 host_->PaintAtSize(TransportDIB::GetFakeHandleForTest(), kPaintAtSizeTag, |
642 gfx::Size(40, 60), gfx::Size(20, 30)); | 642 gfx::Size(40, 60), gfx::Size(20, 30)); |
643 EXPECT_TRUE( | 643 EXPECT_TRUE( |
644 process_->sink().GetUniqueMessageMatching(ViewMsg_PaintAtSize::ID)); | 644 process_->sink().GetUniqueMessageMatching(ViewMsg_PaintAtSize::ID)); |
645 | 645 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 918 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
919 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 919 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
920 SendInputEventACK(WebInputEvent::RawKeyDown, true); | 920 SendInputEventACK(WebInputEvent::RawKeyDown, true); |
921 | 921 |
922 // Wait long enough for first timeout and see if it fired. | 922 // Wait long enough for first timeout and see if it fired. |
923 MessageLoop::current()->PostDelayedTask( | 923 MessageLoop::current()->PostDelayedTask( |
924 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40)); | 924 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40)); |
925 MessageLoop::current()->Run(); | 925 MessageLoop::current()->Run(); |
926 EXPECT_TRUE(host_->unresponsive_timer_fired()); | 926 EXPECT_TRUE(host_->unresponsive_timer_fired()); |
927 } | 927 } |
OLD | NEW |