OLD | NEW |
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/gfx/canvas.h" | 5 #include "app/gfx/canvas.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/keyboard_codes.h" | 7 #include "base/keyboard_codes.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 TEST_F(RenderWidgetHostTest, ResizeThenCrash) { | 304 TEST_F(RenderWidgetHostTest, ResizeThenCrash) { |
305 // Setting the bounds to a "real" rect should send out the notification. | 305 // Setting the bounds to a "real" rect should send out the notification. |
306 gfx::Rect original_size(0, 0, 100, 100); | 306 gfx::Rect original_size(0, 0, 100, 100); |
307 view_->set_bounds(original_size); | 307 view_->set_bounds(original_size); |
308 host_->WasResized(); | 308 host_->WasResized(); |
309 EXPECT_TRUE(host_->resize_ack_pending_); | 309 EXPECT_TRUE(host_->resize_ack_pending_); |
310 EXPECT_EQ(original_size.size(), host_->in_flight_size_); | 310 EXPECT_EQ(original_size.size(), host_->in_flight_size_); |
311 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); | 311 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
312 | 312 |
313 // Simulate a renderer crash before the paint message. Ensure all the resize | 313 // Simulate a renderer crash before the paint message. Ensure all the resize |
314 // ack logic is cleared. | 314 // ack logic is cleared. Must clear the view first so it doesn't get deleted. |
| 315 host_->set_view(NULL); |
315 host_->RendererExited(); | 316 host_->RendererExited(); |
316 EXPECT_FALSE(host_->resize_ack_pending_); | 317 EXPECT_FALSE(host_->resize_ack_pending_); |
317 EXPECT_EQ(gfx::Size(), host_->in_flight_size_); | 318 EXPECT_EQ(gfx::Size(), host_->in_flight_size_); |
318 | 319 |
319 // Reset the view so we can exit the test cleanly. | 320 // Reset the view so we can exit the test cleanly. |
320 view_.reset(new TestView(host_.get())); | 321 host_->set_view(view_.get()); |
321 } | 322 } |
322 | 323 |
323 // Tests setting custom background | 324 // Tests setting custom background |
324 TEST_F(RenderWidgetHostTest, Background) { | 325 TEST_F(RenderWidgetHostTest, Background) { |
325 #if defined(OS_WIN) || defined(OS_LINUX) | 326 #if defined(OS_WIN) || defined(OS_LINUX) |
326 scoped_ptr<RenderWidgetHostView> view( | 327 scoped_ptr<RenderWidgetHostView> view( |
327 RenderWidgetHostView::CreateViewForWidget(host_.get())); | 328 RenderWidgetHostView::CreateViewForWidget(host_.get())); |
328 host_->set_view(view.get()); | 329 host_->set_view(view.get()); |
329 | 330 |
330 // Create a checkerboard background to test with. | 331 // Create a checkerboard background to test with. |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 SendInputEventACK(WebInputEvent::Char, false); | 723 SendInputEventACK(WebInputEvent::Char, false); |
723 EXPECT_TRUE(host_->unhandled_keyboard_event_called()); | 724 EXPECT_TRUE(host_->unhandled_keyboard_event_called()); |
724 EXPECT_EQ(WebInputEvent::Char, host_->unhandled_keyboard_event_type()); | 725 EXPECT_EQ(WebInputEvent::Char, host_->unhandled_keyboard_event_type()); |
725 | 726 |
726 // Send the simulated response of the KeyUp event from the renderer back. | 727 // Send the simulated response of the KeyUp event from the renderer back. |
727 SendInputEventACK(WebInputEvent::KeyUp, false); | 728 SendInputEventACK(WebInputEvent::KeyUp, false); |
728 EXPECT_TRUE(host_->unhandled_keyboard_event_called()); | 729 EXPECT_TRUE(host_->unhandled_keyboard_event_called()); |
729 EXPECT_EQ(WebInputEvent::KeyUp, host_->unhandled_keyboard_event_type()); | 730 EXPECT_EQ(WebInputEvent::KeyUp, host_->unhandled_keyboard_event_type()); |
730 } | 731 } |
731 } | 732 } |
OLD | NEW |