| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "content/test/test_render_view_host.h" | 32 #include "content/test/test_render_view_host.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
| 34 #include "ui/display/screen.h" | 34 #include "ui/display/screen.h" |
| 35 #include "ui/events/blink/web_input_event_traits.h" | 35 #include "ui/events/blink/web_input_event_traits.h" |
| 36 #include "ui/events/keycodes/keyboard_codes.h" | 36 #include "ui/events/keycodes/keyboard_codes.h" |
| 37 #include "ui/gfx/canvas.h" | 37 #include "ui/gfx/canvas.h" |
| 38 | 38 |
| 39 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
| 40 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" | 40 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" |
| 41 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 41 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 42 #include "content/test/mock_gpu_channel_establish_factory.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 #if defined(USE_AURA) || defined(OS_MACOSX) | 45 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 45 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 46 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 48 #if defined(USE_AURA) | 49 #if defined(USE_AURA) |
| 49 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 50 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 50 #include "content/browser/renderer_host/ui_events_helper.h" | 51 #include "content/browser/renderer_host/ui_events_helper.h" |
| 51 #include "ui/aura/test/test_screen.h" | 52 #include "ui/aura/test/test_screen.h" |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 466 |
| 466 browser_context_.reset(new TestBrowserContext()); | 467 browser_context_.reset(new TestBrowserContext()); |
| 467 delegate_.reset(new MockRenderWidgetHostDelegate()); | 468 delegate_.reset(new MockRenderWidgetHostDelegate()); |
| 468 process_ = new RenderWidgetHostProcess(browser_context_.get()); | 469 process_ = new RenderWidgetHostProcess(browser_context_.get()); |
| 469 #if defined(USE_AURA) || defined(OS_MACOSX) | 470 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 470 ImageTransportFactory::InitializeForUnitTests( | 471 ImageTransportFactory::InitializeForUnitTests( |
| 471 std::unique_ptr<ImageTransportFactory>( | 472 std::unique_ptr<ImageTransportFactory>( |
| 472 new NoTransportImageTransportFactory)); | 473 new NoTransportImageTransportFactory)); |
| 473 #endif | 474 #endif |
| 474 #if defined(OS_ANDROID) | 475 #if defined(OS_ANDROID) |
| 476 ContextProviderFactoryImpl::Initialize(&gpu_channel_factory_); |
| 475 ui::ContextProviderFactory::SetInstance( | 477 ui::ContextProviderFactory::SetInstance( |
| 476 ContextProviderFactoryImpl::GetInstance()); | 478 ContextProviderFactoryImpl::GetInstance()); |
| 477 #endif | 479 #endif |
| 478 #if defined(USE_AURA) | 480 #if defined(USE_AURA) |
| 479 screen_.reset(aura::TestScreen::Create(gfx::Size())); | 481 screen_.reset(aura::TestScreen::Create(gfx::Size())); |
| 480 display::Screen::SetScreenInstance(screen_.get()); | 482 display::Screen::SetScreenInstance(screen_.get()); |
| 481 #endif | 483 #endif |
| 482 host_.reset(new MockRenderWidgetHost(delegate_.get(), process_, | 484 host_.reset(new MockRenderWidgetHost(delegate_.get(), process_, |
| 483 process_->GetNextRoutingID())); | 485 process_->GetNextRoutingID())); |
| 484 view_.reset(new TestView(host_.get())); | 486 view_.reset(new TestView(host_.get())); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 498 | 500 |
| 499 #if defined(USE_AURA) | 501 #if defined(USE_AURA) |
| 500 display::Screen::SetScreenInstance(nullptr); | 502 display::Screen::SetScreenInstance(nullptr); |
| 501 screen_.reset(); | 503 screen_.reset(); |
| 502 #endif | 504 #endif |
| 503 #if defined(USE_AURA) || defined(OS_MACOSX) | 505 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 504 ImageTransportFactory::Terminate(); | 506 ImageTransportFactory::Terminate(); |
| 505 #endif | 507 #endif |
| 506 #if defined(OS_ANDROID) | 508 #if defined(OS_ANDROID) |
| 507 ui::ContextProviderFactory::SetInstance(nullptr); | 509 ui::ContextProviderFactory::SetInstance(nullptr); |
| 510 ContextProviderFactoryImpl::Terminate(); |
| 508 #endif | 511 #endif |
| 509 | 512 |
| 510 // Process all pending tasks to avoid leaks. | 513 // Process all pending tasks to avoid leaks. |
| 511 base::RunLoop().RunUntilIdle(); | 514 base::RunLoop().RunUntilIdle(); |
| 512 } | 515 } |
| 513 | 516 |
| 514 void SetInitialRenderSizeParams() { | 517 void SetInitialRenderSizeParams() { |
| 515 ResizeParams render_size_params; | 518 ResizeParams render_size_params; |
| 516 host_->GetResizeParams(&render_size_params); | 519 host_->GetResizeParams(&render_size_params); |
| 517 host_->SetInitialRenderSizeParams(render_size_params); | 520 host_->SetInitialRenderSizeParams(render_size_params); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 RenderWidgetHostProcess* process_; // Deleted automatically by the widget. | 647 RenderWidgetHostProcess* process_; // Deleted automatically by the widget. |
| 645 std::unique_ptr<MockRenderWidgetHostDelegate> delegate_; | 648 std::unique_ptr<MockRenderWidgetHostDelegate> delegate_; |
| 646 std::unique_ptr<MockRenderWidgetHost> host_; | 649 std::unique_ptr<MockRenderWidgetHost> host_; |
| 647 std::unique_ptr<TestView> view_; | 650 std::unique_ptr<TestView> view_; |
| 648 std::unique_ptr<display::Screen> screen_; | 651 std::unique_ptr<display::Screen> screen_; |
| 649 bool handle_key_press_event_; | 652 bool handle_key_press_event_; |
| 650 bool handle_mouse_event_; | 653 bool handle_mouse_event_; |
| 651 double last_simulated_event_time_seconds_; | 654 double last_simulated_event_time_seconds_; |
| 652 double simulated_event_time_delta_seconds_; | 655 double simulated_event_time_delta_seconds_; |
| 653 | 656 |
| 657 #if defined(OS_ANDROID) |
| 658 MockGpuChannelEstablishFactory gpu_channel_factory_; |
| 659 #endif |
| 660 |
| 654 private: | 661 private: |
| 655 SyntheticWebTouchEvent touch_event_; | 662 SyntheticWebTouchEvent touch_event_; |
| 656 | 663 |
| 657 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostTest); | 664 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostTest); |
| 658 }; | 665 }; |
| 659 | 666 |
| 660 #if GTEST_HAS_PARAM_TEST | 667 #if GTEST_HAS_PARAM_TEST |
| 661 // RenderWidgetHostWithSourceTest ---------------------------------------------- | 668 // RenderWidgetHostWithSourceTest ---------------------------------------------- |
| 662 | 669 |
| 663 // This is for tests that are to be run for all source devices. | 670 // This is for tests that are to be run for all source devices. |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 ui::LatencyInfo()); | 1707 ui::LatencyInfo()); |
| 1701 | 1708 |
| 1702 | 1709 |
| 1703 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). | 1710 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). |
| 1704 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); | 1711 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); |
| 1705 | 1712 |
| 1706 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); | 1713 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); |
| 1707 } | 1714 } |
| 1708 | 1715 |
| 1709 } // namespace content | 1716 } // namespace content |
| OLD | NEW |