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/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "ui/aura/layout_manager.h" | 30 #include "ui/aura/layout_manager.h" |
31 #include "ui/aura/root_window.h" | 31 #include "ui/aura/root_window.h" |
32 #include "ui/aura/test/aura_test_helper.h" | 32 #include "ui/aura/test/aura_test_helper.h" |
33 #include "ui/aura/test/test_cursor_client.h" | 33 #include "ui/aura/test/test_cursor_client.h" |
34 #include "ui/aura/test/test_screen.h" | 34 #include "ui/aura/test/test_screen.h" |
35 #include "ui/aura/test/test_window_delegate.h" | 35 #include "ui/aura/test/test_window_delegate.h" |
36 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
37 #include "ui/aura/window_observer.h" | 37 #include "ui/aura/window_observer.h" |
38 #include "ui/base/ui_base_types.h" | 38 #include "ui/base/ui_base_types.h" |
39 #include "ui/compositor/compositor.h" | 39 #include "ui/compositor/compositor.h" |
| 40 #include "ui/compositor/test/test_context_factory.h" |
40 #include "ui/events/event.h" | 41 #include "ui/events/event.h" |
41 #include "ui/events/event_utils.h" | 42 #include "ui/events/event_utils.h" |
42 | 43 |
43 using testing::_; | 44 using testing::_; |
44 | 45 |
45 namespace content { | 46 namespace content { |
46 namespace { | 47 namespace { |
47 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { | 48 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { |
48 public: | 49 public: |
49 MockRenderWidgetHostDelegate() {} | 50 MockRenderWidgetHostDelegate() {} |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 bool has_resize_lock_; | 116 bool has_resize_lock_; |
116 gfx::Size last_frame_size_; | 117 gfx::Size last_frame_size_; |
117 }; | 118 }; |
118 | 119 |
119 class RenderWidgetHostViewAuraTest : public testing::Test { | 120 class RenderWidgetHostViewAuraTest : public testing::Test { |
120 public: | 121 public: |
121 RenderWidgetHostViewAuraTest() | 122 RenderWidgetHostViewAuraTest() |
122 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} | 123 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} |
123 | 124 |
124 virtual void SetUp() { | 125 virtual void SetUp() { |
125 ImageTransportFactory::InitializeForUnitTests(); | 126 ImageTransportFactory::InitializeForUnitTests( |
| 127 scoped_ptr<ui::ContextFactory>(new ui::TestContextFactory)); |
126 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); | 128 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); |
127 aura_test_helper_->SetUp(); | 129 aura_test_helper_->SetUp(); |
128 | 130 |
129 browser_context_.reset(new TestBrowserContext); | 131 browser_context_.reset(new TestBrowserContext); |
130 MockRenderProcessHost* process_host = | 132 MockRenderProcessHost* process_host = |
131 new MockRenderProcessHost(browser_context_.get()); | 133 new MockRenderProcessHost(browser_context_.get()); |
132 | 134 |
133 sink_ = &process_host->sink(); | 135 sink_ = &process_host->sink(); |
134 | 136 |
135 parent_host_ = new RenderWidgetHostImpl( | 137 parent_host_ = new RenderWidgetHostImpl( |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); | 903 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); |
902 view_->OnSwapCompositorFrame( | 904 view_->OnSwapCompositorFrame( |
903 3, MakeDelegatedFrame(1.f, frame_size, view_rect)); | 905 3, MakeDelegatedFrame(1.f, frame_size, view_rect)); |
904 testing::Mock::VerifyAndClearExpectations(&observer); | 906 testing::Mock::VerifyAndClearExpectations(&observer); |
905 view_->RunOnCompositingDidCommit(); | 907 view_->RunOnCompositingDidCommit(); |
906 | 908 |
907 view_->window_->RemoveObserver(&observer); | 909 view_->window_->RemoveObserver(&observer); |
908 } | 910 } |
909 | 911 |
910 } // namespace content | 912 } // namespace content |
OLD | NEW |