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

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

Issue 3547008: Handle resize corner layout entirely in the platform BrowserWindow*/BrowserView* code... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/keyboard_codes.h" 5 #include "app/keyboard_codes.h"
6 #include "base/basictypes.h" 6 #include "base/basictypes.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/shared_memory.h" 8 #include "base/shared_memory.h"
9 #include "base/timer.h" 9 #include "base/timer.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 ASSERT_FALSE(process_->sink().GetFirstMessageMatching(ViewMsg_Resize::ID)); 345 ASSERT_FALSE(process_->sink().GetFirstMessageMatching(ViewMsg_Resize::ID));
346 346
347 // Now clearing the bounds should send out a notification but we shouldn't 347 // Now clearing the bounds should send out a notification but we shouldn't
348 // expect a resize ack (since the renderer won't ack empty sizes). The message 348 // expect a resize ack (since the renderer won't ack empty sizes). The message
349 // should contain the new size (0x0) and not the previous one that we skipped 349 // should contain the new size (0x0) and not the previous one that we skipped
350 process_->sink().ClearMessages(); 350 process_->sink().ClearMessages();
351 view_->set_bounds(gfx::Rect()); 351 view_->set_bounds(gfx::Rect());
352 host_->WasResized(); 352 host_->WasResized();
353 EXPECT_FALSE(host_->resize_ack_pending_); 353 EXPECT_FALSE(host_->resize_ack_pending_);
354 EXPECT_EQ(gfx::Size(), host_->in_flight_size_); 354 EXPECT_EQ(gfx::Size(), host_->in_flight_size_);
355 EXPECT_EQ(gfx::Size(), host_->current_size_);
355 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); 356 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID));
356 357
357 // Send a rect that has no area but has either width or height set. 358 // Send a rect that has no area but has either width or height set.
359 // since we do not expect ACK, current_size_ should be updated right away.
358 process_->sink().ClearMessages(); 360 process_->sink().ClearMessages();
359 view_->set_bounds(gfx::Rect(0, 0, 0, 30)); 361 view_->set_bounds(gfx::Rect(0, 0, 0, 30));
360 host_->WasResized(); 362 host_->WasResized();
361 EXPECT_FALSE(host_->resize_ack_pending_); 363 EXPECT_FALSE(host_->resize_ack_pending_);
362 EXPECT_EQ(gfx::Size(0, 30), host_->in_flight_size_); 364 EXPECT_EQ(gfx::Size(), host_->in_flight_size_);
365 EXPECT_EQ(gfx::Size(0, 30), host_->current_size_);
363 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); 366 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID));
364 367
365 // Set the same size again. It should not be sent again. 368 // Set the same size again. It should not be sent again.
366 process_->sink().ClearMessages(); 369 process_->sink().ClearMessages();
367 host_->WasResized(); 370 host_->WasResized();
368 EXPECT_FALSE(host_->resize_ack_pending_); 371 EXPECT_FALSE(host_->resize_ack_pending_);
369 EXPECT_EQ(gfx::Size(0, 30), host_->in_flight_size_); 372 EXPECT_EQ(gfx::Size(), host_->in_flight_size_);
373 EXPECT_EQ(gfx::Size(0, 30), host_->current_size_);
370 EXPECT_FALSE(process_->sink().GetFirstMessageMatching(ViewMsg_Resize::ID)); 374 EXPECT_FALSE(process_->sink().GetFirstMessageMatching(ViewMsg_Resize::ID));
371 375
372 // A different size should be sent again, however. 376 // A different size should be sent again, however.
373 view_->set_bounds(gfx::Rect(0, 0, 0, 31)); 377 view_->set_bounds(gfx::Rect(0, 0, 0, 31));
374 host_->WasResized(); 378 host_->WasResized();
375 EXPECT_FALSE(host_->resize_ack_pending_); 379 EXPECT_FALSE(host_->resize_ack_pending_);
376 EXPECT_EQ(gfx::Size(0, 31), host_->in_flight_size_); 380 EXPECT_EQ(gfx::Size(), host_->in_flight_size_);
381 EXPECT_EQ(gfx::Size(0, 31), host_->current_size_);
377 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); 382 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID));
378 } 383 }
379 384
380 // Test for crbug.com/25097. If a renderer crashes between a resize and the 385 // Test for crbug.com/25097. If a renderer crashes between a resize and the
381 // corresponding update message, we must be sure to clear the resize ack logic. 386 // corresponding update message, we must be sure to clear the resize ack logic.
382 TEST_F(RenderWidgetHostTest, ResizeThenCrash) { 387 TEST_F(RenderWidgetHostTest, ResizeThenCrash) {
383 // Setting the bounds to a "real" rect should send out the notification. 388 // Setting the bounds to a "real" rect should send out the notification.
384 gfx::Rect original_size(0, 0, 100, 100); 389 gfx::Rect original_size(0, 0, 100, 100);
385 view_->set_bounds(original_size); 390 view_->set_bounds(original_size);
386 host_->WasResized(); 391 host_->WasResized();
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 // Start it again to ensure it still works. 704 // Start it again to ensure it still works.
700 EXPECT_FALSE(host_->unresponsive_timer_fired()); 705 EXPECT_FALSE(host_->unresponsive_timer_fired());
701 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 706 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
702 707
703 // Wait long enough for first timeout and see if it fired. 708 // Wait long enough for first timeout and see if it fired.
704 MessageLoop::current()->PostDelayedTask(FROM_HERE, 709 MessageLoop::current()->PostDelayedTask(FROM_HERE,
705 new MessageLoop::QuitTask(), 10); 710 new MessageLoop::QuitTask(), 10);
706 MessageLoop::current()->Run(); 711 MessageLoop::current()->Run();
707 EXPECT_TRUE(host_->unresponsive_timer_fired()); 712 EXPECT_TRUE(host_->unresponsive_timer_fired());
708 } 713 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host.cc ('k') | chrome/browser/renderer_host/render_widget_host_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698