| 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "cc/output/compositor_frame.h" | 13 #include "cc/output/compositor_frame.h" |
| 14 #include "cc/output/compositor_frame_metadata.h" | 14 #include "cc/output/compositor_frame_metadata.h" |
| 15 #include "cc/output/copy_output_request.h" | 15 #include "cc/output/copy_output_request.h" |
| 16 #include "content/browser/browser_thread_impl.h" | 16 #include "content/browser/browser_thread_impl.h" |
| 17 #include "content/browser/compositor/no_transport_image_transport_factory.h" |
| 17 #include "content/browser/compositor/resize_lock.h" | 18 #include "content/browser/compositor/resize_lock.h" |
| 18 #include "content/browser/renderer_host/overscroll_controller.h" | 19 #include "content/browser/renderer_host/overscroll_controller.h" |
| 19 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 20 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
| 20 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 21 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 21 #include "content/browser/renderer_host/render_widget_host_impl.h" | 22 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 22 #include "content/common/gpu/client/gl_helper.h" | 23 #include "content/common/gpu/client/gl_helper.h" |
| 23 #include "content/common/gpu/gpu_messages.h" | 24 #include "content/common/gpu/gpu_messages.h" |
| 24 #include "content/common/host_shared_bitmap_manager.h" | 25 #include "content/common/host_shared_bitmap_manager.h" |
| 25 #include "content/common/input/synthetic_web_input_event_builders.h" | 26 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 26 #include "content/common/input_messages.h" | 27 #include "content/common/input_messages.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 #include "ui/aura/test/event_generator.h" | 42 #include "ui/aura/test/event_generator.h" |
| 42 #include "ui/aura/test/test_cursor_client.h" | 43 #include "ui/aura/test/test_cursor_client.h" |
| 43 #include "ui/aura/test/test_screen.h" | 44 #include "ui/aura/test/test_screen.h" |
| 44 #include "ui/aura/test/test_window_delegate.h" | 45 #include "ui/aura/test/test_window_delegate.h" |
| 45 #include "ui/aura/window.h" | 46 #include "ui/aura/window.h" |
| 46 #include "ui/aura/window_event_dispatcher.h" | 47 #include "ui/aura/window_event_dispatcher.h" |
| 47 #include "ui/aura/window_observer.h" | 48 #include "ui/aura/window_observer.h" |
| 48 #include "ui/base/ui_base_types.h" | 49 #include "ui/base/ui_base_types.h" |
| 49 #include "ui/compositor/compositor.h" | 50 #include "ui/compositor/compositor.h" |
| 50 #include "ui/compositor/test/draw_waiter_for_test.h" | 51 #include "ui/compositor/test/draw_waiter_for_test.h" |
| 51 #include "ui/compositor/test/in_process_context_factory.h" | |
| 52 #include "ui/events/event.h" | 52 #include "ui/events/event.h" |
| 53 #include "ui/events/event_utils.h" | 53 #include "ui/events/event_utils.h" |
| 54 #include "ui/events/gestures/gesture_configuration.h" | 54 #include "ui/events/gestures/gesture_configuration.h" |
| 55 #include "ui/wm/core/default_activation_client.h" | 55 #include "ui/wm/core/default_activation_client.h" |
| 56 | 56 |
| 57 using testing::_; | 57 using testing::_; |
| 58 | 58 |
| 59 using blink::WebGestureEvent; | 59 using blink::WebGestureEvent; |
| 60 using blink::WebInputEvent; | 60 using blink::WebInputEvent; |
| 61 using blink::WebMouseEvent; | 61 using blink::WebMouseEvent; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 }; | 305 }; |
| 306 | 306 |
| 307 } // namespace | 307 } // namespace |
| 308 | 308 |
| 309 class RenderWidgetHostViewAuraTest : public testing::Test { | 309 class RenderWidgetHostViewAuraTest : public testing::Test { |
| 310 public: | 310 public: |
| 311 RenderWidgetHostViewAuraTest() | 311 RenderWidgetHostViewAuraTest() |
| 312 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} | 312 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} |
| 313 | 313 |
| 314 void SetUpEnvironment() { | 314 void SetUpEnvironment() { |
| 315 ui::ContextFactory* context_factory = new ui::InProcessContextFactory; | |
| 316 ImageTransportFactory::InitializeForUnitTests( | 315 ImageTransportFactory::InitializeForUnitTests( |
| 317 scoped_ptr<ui::ContextFactory>(context_factory)); | 316 new NoTransportImageTransportFactory); |
| 318 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); | 317 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); |
| 319 aura_test_helper_->SetUp(context_factory); | 318 aura_test_helper_->SetUp( |
| 319 ImageTransportFactory::GetInstance()->GetContextFactory()); |
| 320 new wm::DefaultActivationClient(aura_test_helper_->root_window()); | 320 new wm::DefaultActivationClient(aura_test_helper_->root_window()); |
| 321 | 321 |
| 322 browser_context_.reset(new TestBrowserContext); | 322 browser_context_.reset(new TestBrowserContext); |
| 323 process_host_ = new MockRenderProcessHost(browser_context_.get()); | 323 process_host_ = new MockRenderProcessHost(browser_context_.get()); |
| 324 | 324 |
| 325 sink_ = &process_host_->sink(); | 325 sink_ = &process_host_->sink(); |
| 326 | 326 |
| 327 parent_host_ = new RenderWidgetHostImpl( | 327 parent_host_ = new RenderWidgetHostImpl( |
| 328 &delegate_, process_host_, MSG_ROUTING_NONE, false); | 328 &delegate_, process_host_, MSG_ROUTING_NONE, false); |
| 329 parent_view_ = new RenderWidgetHostViewAura(parent_host_); | 329 parent_view_ = new RenderWidgetHostViewAura(parent_host_); |
| (...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2676 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); | 2676 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); |
| 2677 | 2677 |
| 2678 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 2678 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 2679 blink::WebGestureDeviceTouchscreen); | 2679 blink::WebGestureDeviceTouchscreen); |
| 2680 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 2680 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 2681 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); | 2681 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); |
| 2682 EXPECT_EQ(3U, sink_->message_count()); | 2682 EXPECT_EQ(3U, sink_->message_count()); |
| 2683 } | 2683 } |
| 2684 | 2684 |
| 2685 } // namespace content | 2685 } // namespace content |
| OLD | NEW |