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