| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 touch.MovePoint(0, 30, 30); | 394 touch.MovePoint(0, 30, 30); |
| 395 touch.touchStartOrFirstTouchMove = false; | 395 touch.touchStartOrFirstTouchMove = false; |
| 396 widget()->SendInputEvent(touch); | 396 widget()->SendInputEvent(touch); |
| 397 histogram_tester().ExpectTotalCount("Event.Touch.TouchLatencyOutsideFling", | 397 histogram_tester().ExpectTotalCount("Event.Touch.TouchLatencyOutsideFling", |
| 398 2); | 398 2); |
| 399 } | 399 } |
| 400 | 400 |
| 401 class PopupRenderWidget : public RenderWidget { | 401 class PopupRenderWidget : public RenderWidget { |
| 402 public: | 402 public: |
| 403 explicit PopupRenderWidget(CompositorDependencies* compositor_deps) | 403 explicit PopupRenderWidget(CompositorDependencies* compositor_deps) |
| 404 : RenderWidget(1, | 404 : RenderWidget(routing_id_++, |
| 405 compositor_deps, | 405 compositor_deps, |
| 406 blink::WebPopupTypePage, | 406 blink::WebPopupTypePage, |
| 407 ScreenInfo(), | 407 ScreenInfo(), |
| 408 false, | 408 false, |
| 409 false, | 409 false, |
| 410 false) { | 410 false) { |
| 411 Init(RenderWidget::ShowCallback(), mock_webwidget()); | 411 Init(RenderWidget::ShowCallback(), mock_webwidget()); |
| 412 did_show_ = true; | 412 did_show_ = true; |
| 413 } | 413 } |
| 414 | 414 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 425 | 425 |
| 426 bool Send(IPC::Message* msg) override { | 426 bool Send(IPC::Message* msg) override { |
| 427 sink_.OnMessageReceived(*msg); | 427 sink_.OnMessageReceived(*msg); |
| 428 delete msg; | 428 delete msg; |
| 429 return true; | 429 return true; |
| 430 } | 430 } |
| 431 | 431 |
| 432 private: | 432 private: |
| 433 IPC::TestSink sink_; | 433 IPC::TestSink sink_; |
| 434 MockWebWidget mock_webwidget_; | 434 MockWebWidget mock_webwidget_; |
| 435 static int routing_id_; |
| 435 | 436 |
| 436 DISALLOW_COPY_AND_ASSIGN(PopupRenderWidget); | 437 DISALLOW_COPY_AND_ASSIGN(PopupRenderWidget); |
| 437 }; | 438 }; |
| 438 | 439 |
| 440 int PopupRenderWidget::routing_id_ = 1; |
| 441 |
| 439 class RenderWidgetPopupUnittest : public testing::Test { | 442 class RenderWidgetPopupUnittest : public testing::Test { |
| 440 public: | 443 public: |
| 441 RenderWidgetPopupUnittest() | 444 RenderWidgetPopupUnittest() |
| 442 : widget_(new PopupRenderWidget(&compositor_deps_)) { | 445 : widget_(new PopupRenderWidget(&compositor_deps_)) { |
| 443 // RenderWidget::Init does an AddRef that's balanced by a browser-initiated | 446 // RenderWidget::Init does an AddRef that's balanced by a browser-initiated |
| 444 // Close IPC. That Close will never happen in this test, so do a Release | 447 // Close IPC. That Close will never happen in this test, so do a Release |
| 445 // here to ensure |widget_| is properly freed. | 448 // here to ensure |widget_| is properly freed. |
| 446 widget_->Release(); | 449 widget_->Release(); |
| 447 DCHECK(widget_->HasOneRef()); | 450 DCHECK(widget_->HasOneRef()); |
| 448 } | 451 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 blink::WebRect popup_emulated_rect(130, 170, 100, 400); | 526 blink::WebRect popup_emulated_rect(130, 170, 100, 400); |
| 524 widget()->setWindowRect(popup_emulated_rect); | 527 widget()->setWindowRect(popup_emulated_rect); |
| 525 | 528 |
| 526 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); | 529 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); |
| 527 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); | 530 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); |
| 528 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); | 531 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); |
| 529 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); | 532 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); |
| 530 } | 533 } |
| 531 | 534 |
| 532 } // namespace content | 535 } // namespace content |
| OLD | NEW |