| 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" |
| 11 #include "chrome/browser/renderer_host/backing_store.h" | 11 #include "chrome/browser/renderer_host/backing_store.h" |
| 12 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 12 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 13 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using WebKit::WebInputEvent; | 16 using WebKit::WebInputEvent; |
| 17 | 17 |
| 18 // RenderWidgetHostProcess ----------------------------------------------------- | 18 // RenderWidgetHostProcess ----------------------------------------------------- |
| 19 | 19 |
| 20 class RenderWidgetHostProcess : public MockRenderProcessHost { | 20 class RenderWidgetHostProcess : public MockRenderProcessHost { |
| 21 public: | 21 public: |
| 22 explicit RenderWidgetHostProcess(Profile* profile) | 22 explicit RenderWidgetHostProcess(Profile* profile) |
| 23 : MockRenderProcessHost(profile), | 23 : MockRenderProcessHost(profile), |
| 24 current_paint_buf_(NULL), | 24 current_update_buf_(NULL), |
| 25 paint_msg_should_reply_(false), | 25 update_msg_should_reply_(false), |
| 26 paint_msg_reply_flags_(0) { | 26 update_msg_reply_flags_(0) { |
| 27 // DANGER! This is a hack. The RenderWidgetHost checks the channel to see | 27 // DANGER! This is a hack. The RenderWidgetHost checks the channel to see |
| 28 // if the process is still alive, but it doesn't actually dereference it. | 28 // if the process is still alive, but it doesn't actually dereference it. |
| 29 // An IPC::SyncChannel is nontrivial, so we just fake it here. If you end up | 29 // An IPC::SyncChannel is nontrivial, so we just fake it here. If you end up |
| 30 // crashing by dereferencing 1, then you'll have to make a real channel. | 30 // crashing by dereferencing 1, then you'll have to make a real channel. |
| 31 channel_.reset(reinterpret_cast<IPC::SyncChannel*>(0x1)); | 31 channel_.reset(reinterpret_cast<IPC::SyncChannel*>(0x1)); |
| 32 } | 32 } |
| 33 ~RenderWidgetHostProcess() { | 33 ~RenderWidgetHostProcess() { |
| 34 // We don't want to actually delete the channel, since it's not a real | 34 // We don't want to actually delete the channel, since it's not a real |
| 35 // pointer. | 35 // pointer. |
| 36 channel_.release(); | 36 channel_.release(); |
| 37 if (current_paint_buf_) | 37 delete current_update_buf_; |
| 38 delete current_paint_buf_; | |
| 39 } | 38 } |
| 40 | 39 |
| 41 void set_paint_msg_should_reply(bool reply) { | 40 void set_update_msg_should_reply(bool reply) { |
| 42 paint_msg_should_reply_ = reply; | 41 update_msg_should_reply_ = reply; |
| 43 } | 42 } |
| 44 void set_paint_msg_reply_flags(int flags) { | 43 void set_update_msg_reply_flags(int flags) { |
| 45 paint_msg_reply_flags_ = flags; | 44 update_msg_reply_flags_ = flags; |
| 46 } | 45 } |
| 47 | 46 |
| 48 // Fills the given paint parameters with resonable default values. | 47 // Fills the given paint parameters with resonable default values. |
| 49 void InitPaintRectParams(ViewHostMsg_PaintRect_Params* params); | 48 void InitUpdateRectParams(ViewHostMsg_UpdateRect_Params* params); |
| 50 | 49 |
| 51 protected: | 50 protected: |
| 52 virtual bool WaitForPaintMsg(int render_widget_id, | 51 virtual bool WaitForUpdateMsg(int render_widget_id, |
| 53 const base::TimeDelta& max_delay, | 52 const base::TimeDelta& max_delay, |
| 54 IPC::Message* msg); | 53 IPC::Message* msg); |
| 55 | 54 |
| 56 TransportDIB* current_paint_buf_; | 55 TransportDIB* current_update_buf_; |
| 57 | 56 |
| 58 // Set to true when WaitForPaintMsg should return a successful paint messaage | 57 // Set to true when WaitForPaintMsg should return a successful paint messaage |
| 59 // reply. False implies timeout. | 58 // reply. False implies timeout. |
| 60 bool paint_msg_should_reply_; | 59 bool update_msg_should_reply_; |
| 61 | 60 |
| 62 // Indicates the flags that should be sent with a the repaint request. This | 61 // Indicates the flags that should be sent with a the repaint request. This |
| 63 // only has an effect when paint_msg_should_reply_ is true. | 62 // only has an effect when paint_msg_should_reply_ is true. |
| 64 int paint_msg_reply_flags_; | 63 int update_msg_reply_flags_; |
| 65 | 64 |
| 66 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostProcess); | 65 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostProcess); |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 void RenderWidgetHostProcess::InitPaintRectParams( | 68 void RenderWidgetHostProcess::InitUpdateRectParams( |
| 70 ViewHostMsg_PaintRect_Params* params) { | 69 ViewHostMsg_UpdateRect_Params* params) { |
| 71 // Create the shared backing store. | 70 // Create the shared backing store. |
| 72 const int w = 100, h = 100; | 71 const int w = 100, h = 100; |
| 73 const size_t pixel_size = w * h * 4; | 72 const size_t pixel_size = w * h * 4; |
| 74 | 73 |
| 75 if (!current_paint_buf_) | 74 if (!current_update_buf_) |
| 76 current_paint_buf_ = TransportDIB::Create(pixel_size, 0); | 75 current_update_buf_ = TransportDIB::Create(pixel_size, 0); |
| 77 params->bitmap = current_paint_buf_->id(); | 76 params->bitmap = current_update_buf_->id(); |
| 78 params->bitmap_rect = gfx::Rect(0, 0, w, h); | 77 params->bitmap_rect = gfx::Rect(0, 0, w, h); |
| 79 params->update_rects.push_back(params->bitmap_rect); | 78 params->dx = 0; |
| 79 params->dy = 0; |
| 80 params->copy_rects.push_back(params->bitmap_rect); |
| 80 params->view_size = gfx::Size(w, h); | 81 params->view_size = gfx::Size(w, h); |
| 81 params->flags = paint_msg_reply_flags_; | 82 params->flags = update_msg_reply_flags_; |
| 82 } | 83 } |
| 83 | 84 |
| 84 bool RenderWidgetHostProcess::WaitForPaintMsg(int render_widget_id, | 85 bool RenderWidgetHostProcess::WaitForUpdateMsg(int render_widget_id, |
| 85 const base::TimeDelta& max_delay, | 86 const base::TimeDelta& max_delay, |
| 86 IPC::Message* msg) { | 87 IPC::Message* msg) { |
| 87 if (!paint_msg_should_reply_) | 88 if (!update_msg_should_reply_) |
| 88 return false; | 89 return false; |
| 89 | 90 |
| 90 // Construct a fake paint reply. | 91 // Construct a fake paint reply. |
| 91 ViewHostMsg_PaintRect_Params params; | 92 ViewHostMsg_UpdateRect_Params params; |
| 92 InitPaintRectParams(¶ms); | 93 InitUpdateRectParams(¶ms); |
| 93 | 94 |
| 94 ViewHostMsg_PaintRect message(render_widget_id, params); | 95 ViewHostMsg_UpdateRect message(render_widget_id, params); |
| 95 *msg = message; | 96 *msg = message; |
| 96 return true; | 97 return true; |
| 97 } | 98 } |
| 98 | 99 |
| 99 // TestView -------------------------------------------------------------------- | 100 // TestView -------------------------------------------------------------------- |
| 100 | 101 |
| 101 // This test view allows us to specify the size. | 102 // This test view allows us to specify the size. |
| 102 class TestView : public TestRenderWidgetHostView { | 103 class TestView : public TestRenderWidgetHostView { |
| 103 public: | 104 public: |
| 104 explicit TestView(RenderWidgetHost* rwh) : TestRenderWidgetHostView(rwh) {} | 105 explicit TestView(RenderWidgetHost* rwh) : TestRenderWidgetHostView(rwh) {} |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 gfx::Rect original_size(0, 0, 100, 100); | 245 gfx::Rect original_size(0, 0, 100, 100); |
| 245 process_->sink().ClearMessages(); | 246 process_->sink().ClearMessages(); |
| 246 view_->set_bounds(original_size); | 247 view_->set_bounds(original_size); |
| 247 host_->WasResized(); | 248 host_->WasResized(); |
| 248 EXPECT_TRUE(host_->resize_ack_pending_); | 249 EXPECT_TRUE(host_->resize_ack_pending_); |
| 249 EXPECT_EQ(original_size.size(), host_->in_flight_size_); | 250 EXPECT_EQ(original_size.size(), host_->in_flight_size_); |
| 250 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); | 251 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| 251 | 252 |
| 252 // Send out a paint that's not a resize ack. This should not clean the | 253 // Send out a paint that's not a resize ack. This should not clean the |
| 253 // resize ack pending flag. | 254 // resize ack pending flag. |
| 254 ViewHostMsg_PaintRect_Params params; | 255 ViewHostMsg_UpdateRect_Params params; |
| 255 process_->InitPaintRectParams(¶ms); | 256 process_->InitUpdateRectParams(¶ms); |
| 256 host_->OnMsgPaintRect(params); | 257 host_->OnMsgUpdateRect(params); |
| 257 EXPECT_TRUE(host_->resize_ack_pending_); | 258 EXPECT_TRUE(host_->resize_ack_pending_); |
| 258 EXPECT_EQ(original_size.size(), host_->in_flight_size_); | 259 EXPECT_EQ(original_size.size(), host_->in_flight_size_); |
| 259 | 260 |
| 260 // Sending out a new notification should NOT send out a new IPC message since | 261 // Sending out a new notification should NOT send out a new IPC message since |
| 261 // a resize ACK is pending. | 262 // a resize ACK is pending. |
| 262 gfx::Rect second_size(0, 0, 90, 90); | 263 gfx::Rect second_size(0, 0, 90, 90); |
| 263 process_->sink().ClearMessages(); | 264 process_->sink().ClearMessages(); |
| 264 view_->set_bounds(second_size); | 265 view_->set_bounds(second_size); |
| 265 host_->WasResized(); | 266 host_->WasResized(); |
| 266 EXPECT_TRUE(host_->resize_ack_pending_); | 267 EXPECT_TRUE(host_->resize_ack_pending_); |
| 267 EXPECT_EQ(original_size.size(), host_->in_flight_size_); | 268 EXPECT_EQ(original_size.size(), host_->in_flight_size_); |
| 268 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); | 269 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| 269 | 270 |
| 270 // Send a paint that's a resize ack, but for the original_size we sent. Since | 271 // Send a paint that's a resize ack, but for the original_size we sent. Since |
| 271 // this isn't the second_size, the message handler should immediately send | 272 // this isn't the second_size, the message handler should immediately send |
| 272 // a new resize message for the new size to the renderer. | 273 // a new resize message for the new size to the renderer. |
| 273 process_->sink().ClearMessages(); | 274 process_->sink().ClearMessages(); |
| 274 params.flags = ViewHostMsg_PaintRect_Flags::IS_RESIZE_ACK; | 275 params.flags = ViewHostMsg_UpdateRect_Flags::IS_RESIZE_ACK; |
| 275 params.view_size = original_size.size(); | 276 params.view_size = original_size.size(); |
| 276 host_->OnMsgPaintRect(params); | 277 host_->OnMsgUpdateRect(params); |
| 277 EXPECT_TRUE(host_->resize_ack_pending_); | 278 EXPECT_TRUE(host_->resize_ack_pending_); |
| 278 EXPECT_EQ(second_size.size(), host_->in_flight_size_); | 279 EXPECT_EQ(second_size.size(), host_->in_flight_size_); |
| 279 ASSERT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); | 280 ASSERT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| 280 | 281 |
| 281 // Send the resize ack for the latest size. | 282 // Send the resize ack for the latest size. |
| 282 process_->sink().ClearMessages(); | 283 process_->sink().ClearMessages(); |
| 283 params.view_size = second_size.size(); | 284 params.view_size = second_size.size(); |
| 284 host_->OnMsgPaintRect(params); | 285 host_->OnMsgUpdateRect(params); |
| 285 EXPECT_FALSE(host_->resize_ack_pending_); | 286 EXPECT_FALSE(host_->resize_ack_pending_); |
| 286 EXPECT_EQ(gfx::Size(), host_->in_flight_size_); | 287 EXPECT_EQ(gfx::Size(), host_->in_flight_size_); |
| 287 ASSERT_FALSE(process_->sink().GetFirstMessageMatching(ViewMsg_Resize::ID)); | 288 ASSERT_FALSE(process_->sink().GetFirstMessageMatching(ViewMsg_Resize::ID)); |
| 288 | 289 |
| 289 // Now clearing the bounds should send out a notification but we shouldn't | 290 // Now clearing the bounds should send out a notification but we shouldn't |
| 290 // expect a resize ack (since the renderer won't ack empty sizes). The message | 291 // expect a resize ack (since the renderer won't ack empty sizes). The message |
| 291 // should contain the new size (0x0) and not the previous one that we skipped | 292 // should contain the new size (0x0) and not the previous one that we skipped |
| 292 process_->sink().ClearMessages(); | 293 process_->sink().ClearMessages(); |
| 293 view_->set_bounds(gfx::Rect()); | 294 view_->set_bounds(gfx::Rect()); |
| 294 host_->WasResized(); | 295 host_->WasResized(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 // TODO(aa): It would be nice to factor out the painting logic so that we | 392 // TODO(aa): It would be nice to factor out the painting logic so that we |
| 392 // could test that, but it appears that would mean painting everything twice | 393 // could test that, but it appears that would mean painting everything twice |
| 393 // since windows HDC structures are opaque. | 394 // since windows HDC structures are opaque. |
| 394 } | 395 } |
| 395 | 396 |
| 396 // Tests getting the backing store with the renderer not setting repaint ack | 397 // Tests getting the backing store with the renderer not setting repaint ack |
| 397 // flags. | 398 // flags. |
| 398 TEST_F(RenderWidgetHostTest, GetBackingStore_NoRepaintAck) { | 399 TEST_F(RenderWidgetHostTest, GetBackingStore_NoRepaintAck) { |
| 399 // We don't currently have a backing store, and if the renderer doesn't send | 400 // We don't currently have a backing store, and if the renderer doesn't send |
| 400 // one in time, we should get nothing. | 401 // one in time, we should get nothing. |
| 401 process_->set_paint_msg_should_reply(false); | 402 process_->set_update_msg_should_reply(false); |
| 402 BackingStore* backing = host_->GetBackingStore(true); | 403 BackingStore* backing = host_->GetBackingStore(true); |
| 403 EXPECT_FALSE(backing); | 404 EXPECT_FALSE(backing); |
| 404 // The widget host should have sent a request for a repaint, and there should | 405 // The widget host should have sent a request for a repaint, and there should |
| 405 // be no paint ACK. | 406 // be no paint ACK. |
| 406 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); | 407 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); |
| 407 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching( | 408 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching( |
| 408 ViewMsg_PaintRect_ACK::ID)); | 409 ViewMsg_UpdateRect_ACK::ID)); |
| 409 | 410 |
| 410 // Allowing the renderer to reply in time should give is a backing store. | 411 // Allowing the renderer to reply in time should give is a backing store. |
| 411 process_->sink().ClearMessages(); | 412 process_->sink().ClearMessages(); |
| 412 process_->set_paint_msg_should_reply(true); | 413 process_->set_update_msg_should_reply(true); |
| 413 process_->set_paint_msg_reply_flags(0); | 414 process_->set_update_msg_reply_flags(0); |
| 414 backing = host_->GetBackingStore(true); | 415 backing = host_->GetBackingStore(true); |
| 415 EXPECT_TRUE(backing); | 416 EXPECT_TRUE(backing); |
| 416 // The widget host should NOT have sent a request for a repaint, since there | 417 // The widget host should NOT have sent a request for a repaint, since there |
| 417 // was an ACK already pending. | 418 // was an ACK already pending. |
| 418 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); | 419 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); |
| 419 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( | 420 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( |
| 420 ViewMsg_PaintRect_ACK::ID)); | 421 ViewMsg_UpdateRect_ACK::ID)); |
| 421 } | 422 } |
| 422 | 423 |
| 423 // Tests getting the backing store with the renderer sending a repaint ack. | 424 // Tests getting the backing store with the renderer sending a repaint ack. |
| 424 TEST_F(RenderWidgetHostTest, GetBackingStore_RepaintAck) { | 425 TEST_F(RenderWidgetHostTest, GetBackingStore_RepaintAck) { |
| 425 // Doing a request request with the paint message allowed should work and | 426 // Doing a request request with the paint message allowed should work and |
| 426 // the repaint ack should work. | 427 // the repaint ack should work. |
| 427 process_->set_paint_msg_should_reply(true); | 428 process_->set_update_msg_should_reply(true); |
| 428 process_->set_paint_msg_reply_flags( | 429 process_->set_update_msg_reply_flags( |
| 429 ViewHostMsg_PaintRect_Flags::IS_REPAINT_ACK); | 430 ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK); |
| 430 BackingStore* backing = host_->GetBackingStore(true); | 431 BackingStore* backing = host_->GetBackingStore(true); |
| 431 EXPECT_TRUE(backing); | 432 EXPECT_TRUE(backing); |
| 432 // We still should not have sent out a repaint request since the last flags | 433 // We still should not have sent out a repaint request since the last flags |
| 433 // didn't have the repaint ack set, and the pending flag will still be set. | 434 // didn't have the repaint ack set, and the pending flag will still be set. |
| 434 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); | 435 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); |
| 435 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( | 436 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( |
| 436 ViewMsg_PaintRect_ACK::ID)); | 437 ViewMsg_UpdateRect_ACK::ID)); |
| 437 | 438 |
| 438 // Asking again for the backing store should just re-use the existing one | 439 // Asking again for the backing store should just re-use the existing one |
| 439 // and not send any messagse. | 440 // and not send any messagse. |
| 440 process_->sink().ClearMessages(); | 441 process_->sink().ClearMessages(); |
| 441 backing = host_->GetBackingStore(true); | 442 backing = host_->GetBackingStore(true); |
| 442 EXPECT_TRUE(backing); | 443 EXPECT_TRUE(backing); |
| 443 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); | 444 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Repaint::ID)); |
| 444 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching( | 445 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching( |
| 445 ViewMsg_PaintRect_ACK::ID)); | 446 ViewMsg_UpdateRect_ACK::ID)); |
| 446 } | 447 } |
| 447 | 448 |
| 448 // Test that we don't paint when we're hidden, but we still send the ACK. Most | 449 // Test that we don't paint when we're hidden, but we still send the ACK. Most |
| 449 // of the rest of the painting is tested in the GetBackingStore* ones. | 450 // of the rest of the painting is tested in the GetBackingStore* ones. |
| 450 TEST_F(RenderWidgetHostTest, HiddenPaint) { | 451 TEST_F(RenderWidgetHostTest, HiddenPaint) { |
| 451 // Hide the widget, it should have sent out a message to the renderer. | 452 // Hide the widget, it should have sent out a message to the renderer. |
| 452 EXPECT_FALSE(host_->is_hidden_); | 453 EXPECT_FALSE(host_->is_hidden_); |
| 453 host_->WasHidden(); | 454 host_->WasHidden(); |
| 454 EXPECT_TRUE(host_->is_hidden_); | 455 EXPECT_TRUE(host_->is_hidden_); |
| 455 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_WasHidden::ID)); | 456 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_WasHidden::ID)); |
| 456 | 457 |
| 457 // Send it a paint as from the renderer. | 458 // Send it a paint as from the renderer. |
| 458 process_->sink().ClearMessages(); | 459 process_->sink().ClearMessages(); |
| 459 ViewHostMsg_PaintRect_Params params; | 460 ViewHostMsg_UpdateRect_Params params; |
| 460 process_->InitPaintRectParams(¶ms); | 461 process_->InitUpdateRectParams(¶ms); |
| 461 host_->OnMsgPaintRect(params); | 462 host_->OnMsgUpdateRect(params); |
| 462 | 463 |
| 463 // It should have sent out the ACK. | 464 // It should have sent out the ACK. |
| 464 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( | 465 EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( |
| 465 ViewMsg_PaintRect_ACK::ID)); | 466 ViewMsg_UpdateRect_ACK::ID)); |
| 466 | 467 |
| 467 // Now unhide. | 468 // Now unhide. |
| 468 process_->sink().ClearMessages(); | 469 process_->sink().ClearMessages(); |
| 469 host_->WasRestored(); | 470 host_->WasRestored(); |
| 470 EXPECT_FALSE(host_->is_hidden_); | 471 EXPECT_FALSE(host_->is_hidden_); |
| 471 | 472 |
| 472 // It should have sent out a restored message with a request to paint. | 473 // It should have sent out a restored message with a request to paint. |
| 473 const IPC::Message* restored = process_->sink().GetUniqueMessageMatching( | 474 const IPC::Message* restored = process_->sink().GetUniqueMessageMatching( |
| 474 ViewMsg_WasRestored::ID); | 475 ViewMsg_WasRestored::ID); |
| 475 ASSERT_TRUE(restored); | 476 ASSERT_TRUE(restored); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 EXPECT_EQ(ViewMsg_HandleInputEvent::ID, | 548 EXPECT_EQ(ViewMsg_HandleInputEvent::ID, |
| 548 process_->sink().GetMessageAt(0)->type()); | 549 process_->sink().GetMessageAt(0)->type()); |
| 549 process_->sink().ClearMessages(); | 550 process_->sink().ClearMessages(); |
| 550 | 551 |
| 551 // Send the simulated response from the renderer back. | 552 // Send the simulated response from the renderer back. |
| 552 SendInputEventACK(WebInputEvent::KeyUp, false); | 553 SendInputEventACK(WebInputEvent::KeyUp, false); |
| 553 | 554 |
| 554 EXPECT_TRUE(host_->unhandled_keyboard_event_called()); | 555 EXPECT_TRUE(host_->unhandled_keyboard_event_called()); |
| 555 EXPECT_EQ(WebInputEvent::KeyUp, host_->unhandled_keyboard_event_type()); | 556 EXPECT_EQ(WebInputEvent::KeyUp, host_->unhandled_keyboard_event_type()); |
| 556 } | 557 } |
| OLD | NEW |