| 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 18 matching lines...) Expand all Loading... |
| 29 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 30 #include "ui/aura/env.h" | 30 #include "ui/aura/env.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 #if defined(OS_WIN) || defined(USE_AURA) | 33 #if defined(OS_WIN) || defined(USE_AURA) |
| 34 #include "content/browser/renderer_host/ui_events_helper.h" | 34 #include "content/browser/renderer_host/ui_events_helper.h" |
| 35 #include "ui/base/events/event.h" | 35 #include "ui/base/events/event.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 using base::TimeDelta; | 38 using base::TimeDelta; |
| 39 using content::BackingStore; | |
| 40 using content::BrowserThread; | |
| 41 using content::BrowserThreadImpl; | |
| 42 using content::GestureEventFilter; | |
| 43 using content::MockRenderProcessHost; | |
| 44 using content::NativeWebKeyboardEvent; | |
| 45 using content::RenderWidgetHost; | |
| 46 using content::RenderWidgetHostImpl; | |
| 47 using WebKit::WebGestureEvent; | 39 using WebKit::WebGestureEvent; |
| 48 using WebKit::WebInputEvent; | 40 using WebKit::WebInputEvent; |
| 49 using WebKit::WebMouseWheelEvent; | 41 using WebKit::WebMouseWheelEvent; |
| 50 using WebKit::WebTouchEvent; | 42 using WebKit::WebTouchEvent; |
| 51 using WebKit::WebTouchPoint; | 43 using WebKit::WebTouchPoint; |
| 52 | 44 |
| 53 namespace gfx { | 45 namespace content { |
| 54 class Size; | |
| 55 } | |
| 56 | 46 |
| 57 #if defined(OS_WIN) || defined(USE_AURA) | 47 #if defined(OS_WIN) || defined(USE_AURA) |
| 58 bool TouchEventsAreEquivalent(const ui::TouchEvent& first, | 48 bool TouchEventsAreEquivalent(const ui::TouchEvent& first, |
| 59 const ui::TouchEvent& second) { | 49 const ui::TouchEvent& second) { |
| 60 EXPECT_EQ(second.type(), first.type()); | 50 EXPECT_EQ(second.type(), first.type()); |
| 61 if (first.type() != second.type()) | 51 if (first.type() != second.type()) |
| 62 return false; | 52 return false; |
| 63 EXPECT_EQ(second.location().ToString(), first.location().ToString()); | 53 EXPECT_EQ(second.location().ToString(), first.location().ToString()); |
| 64 if (first.location() != second.location()) | 54 if (first.location() != second.location()) |
| 65 return false; | 55 return false; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 87 } | 77 } |
| 88 | 78 |
| 89 return true; | 79 return true; |
| 90 } | 80 } |
| 91 #endif // defined(OS_WIN) || defined(USE_AURA) | 81 #endif // defined(OS_WIN) || defined(USE_AURA) |
| 92 | 82 |
| 93 // RenderWidgetHostProcess ----------------------------------------------------- | 83 // RenderWidgetHostProcess ----------------------------------------------------- |
| 94 | 84 |
| 95 class RenderWidgetHostProcess : public MockRenderProcessHost { | 85 class RenderWidgetHostProcess : public MockRenderProcessHost { |
| 96 public: | 86 public: |
| 97 explicit RenderWidgetHostProcess(content::BrowserContext* browser_context) | 87 explicit RenderWidgetHostProcess(BrowserContext* browser_context) |
| 98 : MockRenderProcessHost(browser_context), | 88 : MockRenderProcessHost(browser_context), |
| 99 current_update_buf_(NULL), | 89 current_update_buf_(NULL), |
| 100 update_msg_should_reply_(false), | 90 update_msg_should_reply_(false), |
| 101 update_msg_reply_flags_(0) { | 91 update_msg_reply_flags_(0) { |
| 102 } | 92 } |
| 103 ~RenderWidgetHostProcess() { | 93 ~RenderWidgetHostProcess() { |
| 104 delete current_update_buf_; | 94 delete current_update_buf_; |
| 105 } | 95 } |
| 106 | 96 |
| 107 void set_update_msg_should_reply(bool reply) { | 97 void set_update_msg_should_reply(bool reply) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 156 |
| 167 ViewHostMsg_UpdateRect message(render_widget_id, params); | 157 ViewHostMsg_UpdateRect message(render_widget_id, params); |
| 168 *msg = message; | 158 *msg = message; |
| 169 return true; | 159 return true; |
| 170 } | 160 } |
| 171 | 161 |
| 172 // TestView -------------------------------------------------------------------- | 162 // TestView -------------------------------------------------------------------- |
| 173 | 163 |
| 174 // This test view allows us to specify the size, and keep track of acked | 164 // This test view allows us to specify the size, and keep track of acked |
| 175 // touch-events. | 165 // touch-events. |
| 176 class TestView : public content::TestRenderWidgetHostView { | 166 class TestView : public TestRenderWidgetHostView { |
| 177 public: | 167 public: |
| 178 explicit TestView(RenderWidgetHostImpl* rwh) | 168 explicit TestView(RenderWidgetHostImpl* rwh) |
| 179 : content::TestRenderWidgetHostView(rwh), | 169 : TestRenderWidgetHostView(rwh), |
| 180 acked_event_count_(0) { | 170 acked_event_count_(0) { |
| 181 } | 171 } |
| 182 | 172 |
| 183 // Sets the bounds returned by GetViewBounds. | 173 // Sets the bounds returned by GetViewBounds. |
| 184 void set_bounds(const gfx::Rect& bounds) { | 174 void set_bounds(const gfx::Rect& bounds) { |
| 185 bounds_ = bounds; | 175 bounds_ = bounds; |
| 186 } | 176 } |
| 187 | 177 |
| 188 const WebTouchEvent& acked_event() const { return acked_event_; } | 178 const WebTouchEvent& acked_event() const { return acked_event_; } |
| 189 int acked_event_count() const { return acked_event_count_; } | 179 int acked_event_count() const { return acked_event_count_; } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 205 protected: | 195 protected: |
| 206 WebTouchEvent acked_event_; | 196 WebTouchEvent acked_event_; |
| 207 int acked_event_count_; | 197 int acked_event_count_; |
| 208 gfx::Rect bounds_; | 198 gfx::Rect bounds_; |
| 209 | 199 |
| 210 DISALLOW_COPY_AND_ASSIGN(TestView); | 200 DISALLOW_COPY_AND_ASSIGN(TestView); |
| 211 }; | 201 }; |
| 212 | 202 |
| 213 // MockRenderWidgetHostDelegate -------------------------------------------- | 203 // MockRenderWidgetHostDelegate -------------------------------------------- |
| 214 | 204 |
| 215 class MockRenderWidgetHostDelegate : public content::RenderWidgetHostDelegate { | 205 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { |
| 216 public: | 206 public: |
| 217 MockRenderWidgetHostDelegate() | 207 MockRenderWidgetHostDelegate() |
| 218 : prehandle_keyboard_event_(false), | 208 : prehandle_keyboard_event_(false), |
| 219 prehandle_keyboard_event_called_(false), | 209 prehandle_keyboard_event_called_(false), |
| 220 prehandle_keyboard_event_type_(WebInputEvent::Undefined), | 210 prehandle_keyboard_event_type_(WebInputEvent::Undefined), |
| 221 unhandled_keyboard_event_called_(false), | 211 unhandled_keyboard_event_called_(false), |
| 222 unhandled_keyboard_event_type_(WebInputEvent::Undefined) { | 212 unhandled_keyboard_event_type_(WebInputEvent::Undefined) { |
| 223 } | 213 } |
| 224 virtual ~MockRenderWidgetHostDelegate() {} | 214 virtual ~MockRenderWidgetHostDelegate() {} |
| 225 | 215 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 256 |
| 267 bool unhandled_keyboard_event_called_; | 257 bool unhandled_keyboard_event_called_; |
| 268 WebInputEvent::Type unhandled_keyboard_event_type_; | 258 WebInputEvent::Type unhandled_keyboard_event_type_; |
| 269 }; | 259 }; |
| 270 | 260 |
| 271 // MockRenderWidgetHost ---------------------------------------------------- | 261 // MockRenderWidgetHost ---------------------------------------------------- |
| 272 | 262 |
| 273 class MockRenderWidgetHost : public RenderWidgetHostImpl { | 263 class MockRenderWidgetHost : public RenderWidgetHostImpl { |
| 274 public: | 264 public: |
| 275 MockRenderWidgetHost( | 265 MockRenderWidgetHost( |
| 276 content::RenderWidgetHostDelegate* delegate, | 266 RenderWidgetHostDelegate* delegate, |
| 277 content::RenderProcessHost* process, | 267 RenderProcessHost* process, |
| 278 int routing_id) | 268 int routing_id) |
| 279 : RenderWidgetHostImpl(delegate, process, routing_id), | 269 : RenderWidgetHostImpl(delegate, process, routing_id), |
| 280 unresponsive_timer_fired_(false) { | 270 unresponsive_timer_fired_(false) { |
| 281 } | 271 } |
| 282 | 272 |
| 283 // Allow poking at a few private members. | 273 // Allow poking at a few private members. |
| 284 using RenderWidgetHostImpl::OnMsgPaintAtSizeAck; | 274 using RenderWidgetHostImpl::OnMsgPaintAtSizeAck; |
| 285 using RenderWidgetHostImpl::OnMsgUpdateRect; | 275 using RenderWidgetHostImpl::OnMsgUpdateRect; |
| 286 using RenderWidgetHostImpl::RendererExited; | 276 using RenderWidgetHostImpl::RendererExited; |
| 287 using RenderWidgetHostImpl::in_flight_size_; | 277 using RenderWidgetHostImpl::in_flight_size_; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 virtual void NotifyRendererUnresponsive() OVERRIDE { | 332 virtual void NotifyRendererUnresponsive() OVERRIDE { |
| 343 unresponsive_timer_fired_ = true; | 333 unresponsive_timer_fired_ = true; |
| 344 } | 334 } |
| 345 | 335 |
| 346 private: | 336 private: |
| 347 bool unresponsive_timer_fired_; | 337 bool unresponsive_timer_fired_; |
| 348 }; | 338 }; |
| 349 | 339 |
| 350 // MockPaintingObserver -------------------------------------------------------- | 340 // MockPaintingObserver -------------------------------------------------------- |
| 351 | 341 |
| 352 class MockPaintingObserver : public content::NotificationObserver { | 342 class MockPaintingObserver : public NotificationObserver { |
| 353 public: | 343 public: |
| 354 void WidgetDidReceivePaintAtSizeAck(RenderWidgetHostImpl* host, | 344 void WidgetDidReceivePaintAtSizeAck(RenderWidgetHostImpl* host, |
| 355 int tag, | 345 int tag, |
| 356 const gfx::Size& size) { | 346 const gfx::Size& size) { |
| 357 host_ = reinterpret_cast<MockRenderWidgetHost*>(host); | 347 host_ = reinterpret_cast<MockRenderWidgetHost*>(host); |
| 358 tag_ = tag; | 348 tag_ = tag; |
| 359 size_ = size; | 349 size_ = size; |
| 360 } | 350 } |
| 361 | 351 |
| 362 void Observe(int type, | 352 void Observe(int type, |
| 363 const content::NotificationSource& source, | 353 const NotificationSource& source, |
| 364 const content::NotificationDetails& details) { | 354 const NotificationDetails& details) { |
| 365 if (type == | 355 if (type == NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK) { |
| 366 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK)
{ | |
| 367 std::pair<int, gfx::Size>* size_ack_details = | 356 std::pair<int, gfx::Size>* size_ack_details = |
| 368 content::Details<std::pair<int, gfx::Size> >(details).ptr(); | 357 Details<std::pair<int, gfx::Size> >(details).ptr(); |
| 369 WidgetDidReceivePaintAtSizeAck( | 358 WidgetDidReceivePaintAtSizeAck( |
| 370 RenderWidgetHostImpl::From( | 359 RenderWidgetHostImpl::From(Source<RenderWidgetHost>(source).ptr()), |
| 371 content::Source<RenderWidgetHost>(source).ptr()), | |
| 372 size_ack_details->first, | 360 size_ack_details->first, |
| 373 size_ack_details->second); | 361 size_ack_details->second); |
| 374 } | 362 } |
| 375 } | 363 } |
| 376 | 364 |
| 377 MockRenderWidgetHost* host() const { return host_; } | 365 MockRenderWidgetHost* host() const { return host_; } |
| 378 int tag() const { return tag_; } | 366 int tag() const { return tag_; } |
| 379 gfx::Size size() const { return size_; } | 367 gfx::Size size() const { return size_; } |
| 380 | 368 |
| 381 private: | 369 private: |
| 382 MockRenderWidgetHost* host_; | 370 MockRenderWidgetHost* host_; |
| 383 int tag_; | 371 int tag_; |
| 384 gfx::Size size_; | 372 gfx::Size size_; |
| 385 }; | 373 }; |
| 386 | 374 |
| 387 | 375 |
| 388 // RenderWidgetHostTest -------------------------------------------------------- | 376 // RenderWidgetHostTest -------------------------------------------------------- |
| 389 | 377 |
| 390 class RenderWidgetHostTest : public testing::Test { | 378 class RenderWidgetHostTest : public testing::Test { |
| 391 public: | 379 public: |
| 392 RenderWidgetHostTest() : process_(NULL) { | 380 RenderWidgetHostTest() : process_(NULL) { |
| 393 } | 381 } |
| 394 ~RenderWidgetHostTest() { | 382 ~RenderWidgetHostTest() { |
| 395 } | 383 } |
| 396 | 384 |
| 397 protected: | 385 protected: |
| 398 // testing::Test | 386 // testing::Test |
| 399 void SetUp() { | 387 void SetUp() { |
| 400 browser_context_.reset(new content::TestBrowserContext()); | 388 browser_context_.reset(new TestBrowserContext()); |
| 401 delegate_.reset(new MockRenderWidgetHostDelegate()); | 389 delegate_.reset(new MockRenderWidgetHostDelegate()); |
| 402 process_ = new RenderWidgetHostProcess(browser_context_.get()); | 390 process_ = new RenderWidgetHostProcess(browser_context_.get()); |
| 403 host_.reset( | 391 host_.reset( |
| 404 new MockRenderWidgetHost(delegate_.get(), process_, MSG_ROUTING_NONE)); | 392 new MockRenderWidgetHost(delegate_.get(), process_, MSG_ROUTING_NONE)); |
| 405 view_.reset(new TestView(host_.get())); | 393 view_.reset(new TestView(host_.get())); |
| 406 host_->SetView(view_.get()); | 394 host_->SetView(view_.get()); |
| 407 host_->Init(); | 395 host_->Init(); |
| 408 } | 396 } |
| 409 void TearDown() { | 397 void TearDown() { |
| 410 view_.reset(); | 398 view_.reset(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 } | 507 } |
| 520 | 508 |
| 521 void ReleaseTouchPoint(int index) { | 509 void ReleaseTouchPoint(int index) { |
| 522 CHECK(index >= 0 && index < touch_event_.touchesLengthCap); | 510 CHECK(index >= 0 && index < touch_event_.touchesLengthCap); |
| 523 touch_event_.touches[index].state = WebKit::WebTouchPoint::StateReleased; | 511 touch_event_.touches[index].state = WebKit::WebTouchPoint::StateReleased; |
| 524 touch_event_.type = WebInputEvent::TouchEnd; | 512 touch_event_.type = WebInputEvent::TouchEnd; |
| 525 } | 513 } |
| 526 | 514 |
| 527 MessageLoopForUI message_loop_; | 515 MessageLoopForUI message_loop_; |
| 528 | 516 |
| 529 scoped_ptr<content::TestBrowserContext> browser_context_; | 517 scoped_ptr<TestBrowserContext> browser_context_; |
| 530 RenderWidgetHostProcess* process_; // Deleted automatically by the widget. | 518 RenderWidgetHostProcess* process_; // Deleted automatically by the widget. |
| 531 scoped_ptr<MockRenderWidgetHostDelegate> delegate_; | 519 scoped_ptr<MockRenderWidgetHostDelegate> delegate_; |
| 532 scoped_ptr<MockRenderWidgetHost> host_; | 520 scoped_ptr<MockRenderWidgetHost> host_; |
| 533 scoped_ptr<TestView> view_; | 521 scoped_ptr<TestView> view_; |
| 534 | 522 |
| 535 private: | 523 private: |
| 536 WebTouchEvent touch_event_; | 524 WebTouchEvent touch_event_; |
| 537 | 525 |
| 538 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostTest); | 526 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostTest); |
| 539 }; | 527 }; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 EXPECT_FALSE(host_->resize_ack_pending_); | 635 EXPECT_FALSE(host_->resize_ack_pending_); |
| 648 EXPECT_EQ(gfx::Size(), host_->in_flight_size_); | 636 EXPECT_EQ(gfx::Size(), host_->in_flight_size_); |
| 649 | 637 |
| 650 // Reset the view so we can exit the test cleanly. | 638 // Reset the view so we can exit the test cleanly. |
| 651 host_->SetView(view_.get()); | 639 host_->SetView(view_.get()); |
| 652 } | 640 } |
| 653 | 641 |
| 654 // Tests setting custom background | 642 // Tests setting custom background |
| 655 TEST_F(RenderWidgetHostTest, Background) { | 643 TEST_F(RenderWidgetHostTest, Background) { |
| 656 #if !defined(OS_MACOSX) | 644 #if !defined(OS_MACOSX) |
| 657 scoped_ptr<content::RenderWidgetHostView> view( | 645 scoped_ptr<RenderWidgetHostView> view( |
| 658 content::RenderWidgetHostView::CreateViewForWidget(host_.get())); | 646 RenderWidgetHostView::CreateViewForWidget(host_.get())); |
| 659 #if defined(OS_LINUX) || defined(USE_AURA) | 647 #if defined(OS_LINUX) || defined(USE_AURA) |
| 660 // TODO(derat): Call this on all platforms: http://crbug.com/102450. | 648 // TODO(derat): Call this on all platforms: http://crbug.com/102450. |
| 661 // InitAsChild doesn't seem to work if NULL parent is passed on Windows, | 649 // InitAsChild doesn't seem to work if NULL parent is passed on Windows, |
| 662 // which leads to DCHECK failure in RenderWidgetHostView::Destroy. | 650 // which leads to DCHECK failure in RenderWidgetHostView::Destroy. |
| 663 // When you enable this for OS_WIN, enable |view.release()->Destroy()| | 651 // When you enable this for OS_WIN, enable |view.release()->Destroy()| |
| 664 // below. | 652 // below. |
| 665 view->InitAsChild(NULL); | 653 view->InitAsChild(NULL); |
| 666 #endif | 654 #endif |
| 667 host_->SetView(view.get()); | 655 host_->SetView(view.get()); |
| 668 | 656 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 698 sent_background.a.lockPixels(); | 686 sent_background.a.lockPixels(); |
| 699 EXPECT_TRUE(0 == memcmp(background.getPixels(), | 687 EXPECT_TRUE(0 == memcmp(background.getPixels(), |
| 700 sent_background.a.getPixels(), | 688 sent_background.a.getPixels(), |
| 701 background.getSize())); | 689 background.getSize())); |
| 702 sent_background.a.unlockPixels(); | 690 sent_background.a.unlockPixels(); |
| 703 background.unlockPixels(); | 691 background.unlockPixels(); |
| 704 | 692 |
| 705 #if defined(OS_LINUX) || defined(USE_AURA) | 693 #if defined(OS_LINUX) || defined(USE_AURA) |
| 706 // See the comment above |InitAsChild(NULL)|. | 694 // See the comment above |InitAsChild(NULL)|. |
| 707 host_->SetView(NULL); | 695 host_->SetView(NULL); |
| 708 static_cast<content::RenderWidgetHostViewPort*>(view.release())->Destroy(); | 696 static_cast<RenderWidgetHostViewPort*>(view.release())->Destroy(); |
| 709 #endif | 697 #endif |
| 710 | 698 |
| 711 #else | 699 #else |
| 712 // TODO(port): Mac does not have gfx::Canvas. Maybe we can just change this | 700 // TODO(port): Mac does not have gfx::Canvas. Maybe we can just change this |
| 713 // test to use SkCanvas directly? | 701 // test to use SkCanvas directly? |
| 714 #endif | 702 #endif |
| 715 | 703 |
| 716 // TODO(aa): It would be nice to factor out the painting logic so that we | 704 // TODO(aa): It would be nice to factor out the painting logic so that we |
| 717 // could test that, but it appears that would mean painting everything twice | 705 // could test that, but it appears that would mean painting everything twice |
| 718 // since windows HDC structures are opaque. | 706 // since windows HDC structures are opaque. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 EXPECT_TRUE(needs_repaint.a); | 802 EXPECT_TRUE(needs_repaint.a); |
| 815 } | 803 } |
| 816 | 804 |
| 817 TEST_F(RenderWidgetHostTest, PaintAtSize) { | 805 TEST_F(RenderWidgetHostTest, PaintAtSize) { |
| 818 const int kPaintAtSizeTag = 42; | 806 const int kPaintAtSizeTag = 42; |
| 819 host_->PaintAtSize(TransportDIB::GetFakeHandleForTest(), kPaintAtSizeTag, | 807 host_->PaintAtSize(TransportDIB::GetFakeHandleForTest(), kPaintAtSizeTag, |
| 820 gfx::Size(40, 60), gfx::Size(20, 30)); | 808 gfx::Size(40, 60), gfx::Size(20, 30)); |
| 821 EXPECT_TRUE( | 809 EXPECT_TRUE( |
| 822 process_->sink().GetUniqueMessageMatching(ViewMsg_PaintAtSize::ID)); | 810 process_->sink().GetUniqueMessageMatching(ViewMsg_PaintAtSize::ID)); |
| 823 | 811 |
| 824 content::NotificationRegistrar registrar; | 812 NotificationRegistrar registrar; |
| 825 MockPaintingObserver observer; | 813 MockPaintingObserver observer; |
| 826 registrar.Add( | 814 registrar.Add( |
| 827 &observer, | 815 &observer, |
| 828 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, | 816 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, |
| 829 content::Source<RenderWidgetHost>(host_.get())); | 817 Source<RenderWidgetHost>(host_.get())); |
| 830 | 818 |
| 831 host_->OnMsgPaintAtSizeAck(kPaintAtSizeTag, gfx::Size(20, 30)); | 819 host_->OnMsgPaintAtSizeAck(kPaintAtSizeTag, gfx::Size(20, 30)); |
| 832 EXPECT_EQ(host_.get(), observer.host()); | 820 EXPECT_EQ(host_.get(), observer.host()); |
| 833 EXPECT_EQ(kPaintAtSizeTag, observer.tag()); | 821 EXPECT_EQ(kPaintAtSizeTag, observer.tag()); |
| 834 EXPECT_EQ(20, observer.size().width()); | 822 EXPECT_EQ(20, observer.size().width()); |
| 835 EXPECT_EQ(30, observer.size().height()); | 823 EXPECT_EQ(30, observer.size().height()); |
| 836 } | 824 } |
| 837 | 825 |
| 838 // Fails on Linux Aura, see http://crbug.com/100344 | 826 // Fails on Linux Aura, see http://crbug.com/100344 |
| 839 #if defined(USE_AURA) && !defined(OS_WIN) | 827 #if defined(USE_AURA) && !defined(OS_WIN) |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 WebInputEvent::Type acks[] = { WebInputEvent::TouchStart, | 1641 WebInputEvent::Type acks[] = { WebInputEvent::TouchStart, |
| 1654 WebInputEvent::TouchMove, | 1642 WebInputEvent::TouchMove, |
| 1655 WebInputEvent::TouchStart, | 1643 WebInputEvent::TouchStart, |
| 1656 WebInputEvent::TouchMove }; | 1644 WebInputEvent::TouchMove }; |
| 1657 | 1645 |
| 1658 for (size_t i = 0; i < arraysize(acks); ++i) { | 1646 for (size_t i = 0; i < arraysize(acks); ++i) { |
| 1659 SendInputEventACK(acks[i], false); | 1647 SendInputEventACK(acks[i], false); |
| 1660 EXPECT_EQ(acks[i], view_->acked_event().type); | 1648 EXPECT_EQ(acks[i], view_->acked_event().type); |
| 1661 ScopedVector<ui::TouchEvent> acked; | 1649 ScopedVector<ui::TouchEvent> acked; |
| 1662 | 1650 |
| 1663 content::MakeUITouchEventsFromWebTouchEvents(view_->acked_event(), &acked); | 1651 MakeUITouchEventsFromWebTouchEvents(view_->acked_event(), &acked); |
| 1664 bool success = EventListIsSubset(acked, expected_events); | 1652 bool success = EventListIsSubset(acked, expected_events); |
| 1665 EXPECT_TRUE(success) << "Failed on step: " << i; | 1653 EXPECT_TRUE(success) << "Failed on step: " << i; |
| 1666 if (!success) | 1654 if (!success) |
| 1667 break; | 1655 break; |
| 1668 expected_events.erase(expected_events.begin(), | 1656 expected_events.erase(expected_events.begin(), |
| 1669 expected_events.begin() + acked.size()); | 1657 expected_events.begin() + acked.size()); |
| 1670 } | 1658 } |
| 1671 | 1659 |
| 1672 EXPECT_EQ(0U, expected_events.size()); | 1660 EXPECT_EQ(0U, expected_events.size()); |
| 1673 } | 1661 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 TEST_F(RenderWidgetHostTest, IncorrectBitmapScaleFactor) { | 1739 TEST_F(RenderWidgetHostTest, IncorrectBitmapScaleFactor) { |
| 1752 ViewHostMsg_UpdateRect_Params params; | 1740 ViewHostMsg_UpdateRect_Params params; |
| 1753 process_->InitUpdateRectParams(¶ms); | 1741 process_->InitUpdateRectParams(¶ms); |
| 1754 params.scale_factor = params.scale_factor * 2; | 1742 params.scale_factor = params.scale_factor * 2; |
| 1755 | 1743 |
| 1756 EXPECT_EQ(0, process_->bad_msg_count()); | 1744 EXPECT_EQ(0, process_->bad_msg_count()); |
| 1757 host_->OnMsgUpdateRect(params); | 1745 host_->OnMsgUpdateRect(params); |
| 1758 EXPECT_EQ(1, process_->bad_msg_count()); | 1746 EXPECT_EQ(1, process_->bad_msg_count()); |
| 1759 } | 1747 } |
| 1760 #endif | 1748 #endif |
| 1749 |
| 1750 } // namespace content |
| OLD | NEW |