Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 145293007: ui: No more TestCompositor. Use NullDraw contexts in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testsnulldraw: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 24 matching lines...) Expand all
35 #include "ui/aura/root_window.h" 35 #include "ui/aura/root_window.h"
36 #include "ui/aura/test/aura_test_helper.h" 36 #include "ui/aura/test/aura_test_helper.h"
37 #include "ui/aura/test/test_cursor_client.h" 37 #include "ui/aura/test/test_cursor_client.h"
38 #include "ui/aura/test/test_screen.h" 38 #include "ui/aura/test/test_screen.h"
39 #include "ui/aura/test/test_window_delegate.h" 39 #include "ui/aura/test/test_window_delegate.h"
40 #include "ui/aura/window.h" 40 #include "ui/aura/window.h"
41 #include "ui/aura/window_observer.h" 41 #include "ui/aura/window_observer.h"
42 #include "ui/base/ui_base_types.h" 42 #include "ui/base/ui_base_types.h"
43 #include "ui/compositor/compositor.h" 43 #include "ui/compositor/compositor.h"
44 #include "ui/compositor/test/draw_waiter_for_test.h" 44 #include "ui/compositor/test/draw_waiter_for_test.h"
45 #include "ui/compositor/test/test_context_factory.h" 45 #include "ui/compositor/test/in_process_context_factory.h"
46 #include "ui/events/event.h" 46 #include "ui/events/event.h"
47 #include "ui/events/event_utils.h" 47 #include "ui/events/event_utils.h"
48 48
49 using testing::_; 49 using testing::_;
50 50
51 namespace content { 51 namespace content {
52 namespace { 52 namespace {
53 53
54 // Simple screen position client to test coordinate system conversion. 54 // Simple screen position client to test coordinate system conversion.
55 class TestScreenPositionClient 55 class TestScreenPositionClient
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 scoped_ptr<cc::CopyOutputRequest> last_copy_request_; 186 scoped_ptr<cc::CopyOutputRequest> last_copy_request_;
187 }; 187 };
188 188
189 class RenderWidgetHostViewAuraTest : public testing::Test { 189 class RenderWidgetHostViewAuraTest : public testing::Test {
190 public: 190 public:
191 RenderWidgetHostViewAuraTest() 191 RenderWidgetHostViewAuraTest()
192 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {} 192 : browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {}
193 193
194 void SetUpEnvironment() { 194 void SetUpEnvironment() {
195 ImageTransportFactory::InitializeForUnitTests( 195 ImageTransportFactory::InitializeForUnitTests(
196 scoped_ptr<ui::ContextFactory>(new ui::TestContextFactory)); 196 scoped_ptr<ui::ContextFactory>(new ui::InProcessContextFactory));
197 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); 197 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
198 bool allow_test_contexts = true; 198 aura_test_helper_->SetUp();
199 aura_test_helper_->SetUp(allow_test_contexts);
200 199
201 browser_context_.reset(new TestBrowserContext); 200 browser_context_.reset(new TestBrowserContext);
202 process_host_ = new MockRenderProcessHost(browser_context_.get()); 201 process_host_ = new MockRenderProcessHost(browser_context_.get());
203 202
204 sink_ = &process_host_->sink(); 203 sink_ = &process_host_->sink();
205 204
206 parent_host_ = new RenderWidgetHostImpl( 205 parent_host_ = new RenderWidgetHostImpl(
207 &delegate_, process_host_, MSG_ROUTING_NONE, false); 206 &delegate_, process_host_, MSG_ROUTING_NONE, false);
208 parent_view_ = static_cast<RenderWidgetHostViewAura*>( 207 parent_view_ = static_cast<RenderWidgetHostViewAura*>(
209 RenderWidgetHostView::CreateViewForWidget(parent_host_)); 208 RenderWidgetHostView::CreateViewForWidget(parent_host_));
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 1357
1359 // Because the copy request callback may be holding state within it, that 1358 // Because the copy request callback may be holding state within it, that
1360 // state must handle the RWHVA and ImageTransportFactory going away before the 1359 // state must handle the RWHVA and ImageTransportFactory going away before the
1361 // callback is called. This test passes if it does not crash as a result of 1360 // callback is called. This test passes if it does not crash as a result of
1362 // these things being destroyed. 1361 // these things being destroyed.
1363 EXPECT_EQ(2, callback_count_); 1362 EXPECT_EQ(2, callback_count_);
1364 EXPECT_FALSE(result_); 1363 EXPECT_FALSE(result_);
1365 } 1364 }
1366 1365
1367 } // namespace content 1366 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698