Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 9980016: Delete background tab IOSurfaces on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed some perf issues on mac Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 #endif 501 #endif
502 502
503 // TODO(aa): It would be nice to factor out the painting logic so that we 503 // TODO(aa): It would be nice to factor out the painting logic so that we
504 // could test that, but it appears that would mean painting everything twice 504 // could test that, but it appears that would mean painting everything twice
505 // since windows HDC structures are opaque. 505 // since windows HDC structures are opaque.
506 } 506 }
507 507
508 // Tests getting the backing store with the renderer not setting repaint ack 508 // Tests getting the backing store with the renderer not setting repaint ack
509 // flags. 509 // flags.
510 TEST_F(RenderWidgetHostTest, GetBackingStore_NoRepaintAck) { 510 TEST_F(RenderWidgetHostTest, GetBackingStore_NoRepaintAck) {
511 // First set the view size to match what the renderer is rendering.
512 ViewHostMsg_UpdateRect_Params params;
513 process_->InitUpdateRectParams(&params);
514 view_->set_bounds(gfx::Rect(params.view_size));
515
511 // We don't currently have a backing store, and if the renderer doesn't send 516 // We don't currently have a backing store, and if the renderer doesn't send
512 // one in time, we should get nothing. 517 // one in time, we should get nothing.
513 process_->set_update_msg_should_reply(false); 518 process_->set_update_msg_should_reply(false);
514 BackingStore* backing = host_->GetBackingStore(true); 519 BackingStore* backing = host_->GetBackingStore(true);
515 EXPECT_FALSE(backing); 520 EXPECT_FALSE(backing);
516 // The widget host should have sent a request for a repaint, and there should 521 // The widget host should have sent a request for a repaint, and there should
517 // be no paint ACK. 522 // be no paint ACK.
518 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); 523 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID));
519 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching( 524 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(
520 ViewMsg_UpdateRect_ACK::ID)); 525 ViewMsg_UpdateRect_ACK::ID));
521 526
522 // Allowing the renderer to reply in time should give is a backing store. 527 // Allowing the renderer to reply in time should give is a backing store.
523 process_->sink().ClearMessages(); 528 process_->sink().ClearMessages();
524 process_->set_update_msg_should_reply(true); 529 process_->set_update_msg_should_reply(true);
525 process_->set_update_msg_reply_flags(0); 530 process_->set_update_msg_reply_flags(0);
526 backing = host_->GetBackingStore(true); 531 backing = host_->GetBackingStore(true);
527 EXPECT_TRUE(backing); 532 EXPECT_TRUE(backing);
528 // The widget host should NOT have sent a request for a repaint, since there 533 // The widget host should NOT have sent a request for a repaint, since there
529 // was an ACK already pending. 534 // was an ACK already pending.
530 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); 535 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID));
531 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( 536 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(
532 ViewMsg_UpdateRect_ACK::ID)); 537 ViewMsg_UpdateRect_ACK::ID));
533 } 538 }
534 539
535 // Tests getting the backing store with the renderer sending a repaint ack. 540 // Tests getting the backing store with the renderer sending a repaint ack.
536 TEST_F(RenderWidgetHostTest, GetBackingStore_RepaintAck) { 541 TEST_F(RenderWidgetHostTest, GetBackingStore_RepaintAck) {
542 // First set the view size to match what the renderer is rendering.
543 ViewHostMsg_UpdateRect_Params params;
544 process_->InitUpdateRectParams(&params);
545 view_->set_bounds(gfx::Rect(params.view_size));
546
537 // Doing a request request with the update message allowed should work and 547 // Doing a request request with the update message allowed should work and
538 // the repaint ack should work. 548 // the repaint ack should work.
539 process_->set_update_msg_should_reply(true); 549 process_->set_update_msg_should_reply(true);
540 process_->set_update_msg_reply_flags( 550 process_->set_update_msg_reply_flags(
541 ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK); 551 ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK);
542 BackingStore* backing = host_->GetBackingStore(true); 552 BackingStore* backing = host_->GetBackingStore(true);
543 EXPECT_TRUE(backing); 553 EXPECT_TRUE(backing);
544 // We still should not have sent out a repaint request since the last flags 554 // We still should not have sent out a repaint request since the last flags
545 // didn't have the repaint ack set, and the pending flag will still be set. 555 // didn't have the repaint ack set, and the pending flag will still be set.
546 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); 556 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID));
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); 809 SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
800 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); 810 SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
801 SendInputEventACK(WebInputEvent::RawKeyDown, true); 811 SendInputEventACK(WebInputEvent::RawKeyDown, true);
802 812
803 // Wait long enough for first timeout and see if it fired. 813 // Wait long enough for first timeout and see if it fired.
804 MessageLoop::current()->PostDelayedTask( 814 MessageLoop::current()->PostDelayedTask(
805 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40)); 815 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40));
806 MessageLoop::current()->Run(); 816 MessageLoop::current()->Run();
807 EXPECT_TRUE(host_->unresponsive_timer_fired()); 817 EXPECT_TRUE(host_->unresponsive_timer_fired());
808 } 818 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698